Last active
May 12, 2018 13:35
-
-
Save gautamr/b049a98e253b7495649d47b697e979e2 to your computer and use it in GitHub Desktop.
mulple-git-account
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
# for personal github.com | |
ssh-keygen -t rsa -C "[email protected]" | |
# save it as id_rsa (which is default) | |
# for company | |
ssh-keygen | |
# save it as id_rsa_XXX (which is NOT default) when prompted | |
# delete cached ids | |
ssh-add -D | |
# add multiple | |
ssh-add id_rsa | |
ssh-add id_rsa_XXX | |
# list to configrm | |
aad-add -l | |
# github.com personal | |
Host github.com | |
HostName github.com | |
User git | |
IdentityFile ~/.ssh/id_rsa | |
# bitbucket.ord | |
Host bitbucket.org | |
User git | |
Hostname bitbucket.org | |
PreferredAuthentications publickey | |
IdentitiesOnly yes | |
IdentityFile ~/.ssh/id_rsa_YYY | |
# github | |
Host XXX | |
HostName github.com | |
User git | |
IdentityFile ~/.ssh/id_rsa_XXX | |
# copy | |
cat ~/.ssh/id_rsa.pub | xclip -sel clip | |
cat ~/.ssh/id_rsa_XXX.pub | xclip -sel clip | |
# test | |
ssh -T github.com | |
ssh -T XXX | |
# or | |
ssh -T bitbucket.ord |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment