Git GitLab Add SSH
Add SSH to GitLab
Now that you have generated your SSH key, you need to add your public key to your GitLab account.
Copy Your Public SSH Key
- On Windows (Git Bash):
clip < ~/.ssh/id_rsa.pub
- On macOS:
pbcopy < ~/.ssh/id_rsa.pub
- On Linux:
cat ~/.ssh/id_rsa.pub
(then copy manually)
Important: Complete these steps before you attempt to push, pull, or clone with SSH. This page assumes you have already generated your SSH key and added it to your SSH agent. If not, go back to the SSH setup section in the Getting Started guide.
Add the Key to GitLab
- Go to GitLab, click your profile picture in the lower left corner, and select Edit profile:
Go to GitLab, navigate to the lower left corner, click your profile, and select: Edit profile:
Then select "SSH keys". Select a title, and paste the public SSH key into the "Key" field, and click "Add Key":
You will be prompted to supply your SSH passphrase.
You will see your new SSH key added:
Next, you'll test your SSH connection and set your GitHub remote origin using SSH.