Last active
August 15, 2018 15:46
-
-
Save FerrielMelarpis/5a461e0d570bd8088645141d74b62733 to your computer and use it in GitHub Desktop.
Configuring multiple ssh accounts for multiple git accounts (GitHub,GitLab,etc.)
This file contains 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
# ~/.ssh/config | |
# Account 1 | |
Host host1 | |
HostName github.com | |
User git | |
PreferredAuthentications publickey | |
IdentityFile ~/.ssh/id_rsa_host1 | |
# Account 2 | |
Host host2 | |
HostName gitlab.com | |
User git | |
PreferredAuthentications publickey | |
IdentityFile ~/.ssh/id_rsa_host2 | |
# Usages: | |
# git clone host1:<username/organization>/repo.git | |
# git clone host2:<username/organization>/repo.git | |
# Notes: | |
# You can also use this approach for logging in to other machines using ssh | |
# e.g. ssh host1 | |
# Just be sure to configure the `User` option or specify it on cmd `ssh user@host1` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment