Skip to content

Instantly share code, notes, and snippets.

@shafinmahmud
Last active January 3, 2018 15:21
Show Gist options
  • Save shafinmahmud/ef8916c9263bd659f8d3e0d1e8447de3 to your computer and use it in GitHub Desktop.
Save shafinmahmud/ef8916c9263bd659f8d3e0d1e8447de3 to your computer and use it in GitHub Desktop.
Configuring Multiple SSH keys for Multiple github accounts
$ ssh-keygen -t rsa -C "<work-email>"
~/.ssh/id_rsa
~/.ssh/id_rsa_<work-id>
$ ssh-add -D
$ ssh-add ~/.ssh/id_rsa
$ ssh-add ~/.ssh/id_rsa_<work-id>
$ ssh-add -l
$ cd ~/.ssh/
$ touch config
$ vim config
#personal account
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
#work account
Host github.com-<work-id>
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_<work-id>
git clone [email protected]<work-id>:/github-repo.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment