Step 1: Install package and generate SSH key
Run the following commands to install Git and generate an SSH key:~/.ssh/id_ed25519) and optionally add a passphrase.
Step 2: Start the SSH agent and add key to the agent
Step 3: Copy the public SSH key to GitLab
Run the following command to print your public key:- Go to your GitLab profile settings.
- Navigate to SSH Keys.
- Paste your SSH key into the Key field.
- Add a descriptive title in the Title field.
- Click Add key.
Step 4: Test the connection
Step 5: Clone a repository, commit, push, and pull
Clone the repository and create a test file:Push changes
Pull changes
Note: Replace main with the appropriate branch name if it differs.