Using multiple SSH keys.

There might be situations where one might want to use different SSH keys for different sites. And here’s how to do it.

SSH keys

I’m assuming that we have already generated different SSH keys for and in ~/.ssh/.

$ cd ~/.ssh
$ ls
id_rsa  github_rsa bitbucket_rsa


Now create a config file in ~/.ssh.

$ cd ~/.ssh
$ touch config

And add the following lines to the file using your favorite editor.

  IdentityFile ~/.ssh/github_rsa
  IdentityFile ~/.ssh/bitbucket_rsa

Reload the SSH service (depends on your system) and your are all set.

Wrap Up

I hope you find this tip useful. Let me know using comments down below or tweet me @_vkbansal.