Working with non-default SSH key pair paths

If you used a non-default file path for your GitLab SSH key pair, you must configure your SSH client to find your GitLab private SSH key for connections to GitLab.

Open a terminal and use the following commands (replacing other_id_rsa with your private SSH key):

eval $(ssh-agent -s)
ssh-add ~/.ssh/other_id_rsa

To retain these settings, you’ll need to save them to a configuration file. For OpenSSH clients this is configured in the ~/.ssh/config file. In this file you can set up configurations for multiple hosts, like GitLab.com, your own GitLab instance, GitHub, Bitbucket, etc.

Below are two example host configurations using their own SSH key:

# GitLab.com
Host gitlab.com
Preferredauthentications publickey
IdentityFile ~/.ssh/gitlab_com_rsa