Using multiple public/private keys with ssh

To use multiple public/private keys with ssh, instead of having to specify which key you want to use for which host on the command line, you can create a $HOME/.ssh/config as such:

# Default Identity to use
IdentityFile ~/.ssh/id_rsa

# I create a different key-pair for each host
Host heroku.com
IdentityFile ~/.ssh/id_rsa-heroku

Host github.com
IdentityFile ~/.ssh/id_rsa-github

Leave a Reply

Your email address will not be published. Required fields are marked *


× 7 = fourteen

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>