Use the multiple ssh keys with github
It is a quick note about how to handle multiple ssh keys for github.com.
First of all lets create two diffirent ssh keys:
$ ssh-keygen -t rsa -b 4096 -C "first_email@example.com" -f .ssh/first_key
$ ssh-keygen -t rsa -b 4096 -C "second_email@example.com" -f .ssh/second_key
After that create the config file in .ssh
directory:
$ touch .ssh/config
and put the configuration in:
Host first.github.com
HostName github.com
User git
IdentityFile ~/.ssh/first_key
Host second.github.com
HostName github.com
User git
IdentityFile ~/.ssh/second_key
Now you can use different keys depends of path.
$ ssh git@first.github.com
$ ssh git@second.github.com