Last active
October 21, 2019 04:40
-
-
Save mynameiskreang/deb3fd3b41d7dda664ab0d3597710ef9 to your computer and use it in GitHub Desktop.
Working with non-default SSH key pair paths
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
# Private GitLab instance | |
Host gitlab.company.com | |
Preferredauthentications publickey | |
IdentityFile ~/.ssh/example_com_rsa |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment