views:

44

answers:

2

I'm having some trouble getting two different SSH keys/GitHub accounts to play well together. I have the following setup:

Repos accessible from one account using [email protected]:accountname Repos accessible from another account using [email protected]:anotheraccount

Each account has its own SSH key. Both SSH keys have been added and I have created a config file. I don't believe the config file is correct though. I'm not quite sure how to specify that repos accessed using [email protected]:accountname should use id_rsa and [email protected]:anotheraccount should use id_rsa_anotheraccount.

A: 

Use the "IdentityFile" parameter:

Host github.com
    HostName github.com
    IdentityFile ~/.ssh/github.rsa
    User petdance
Andy Lester
This is documented at http://help.github.com/multiple-keys/
Stephen Jennings
Thanks but this isn't quite accurate. I found the answer and shared below.
radesix
I'm pretty sure my approach will work in your case. You can identify different users and different identity files. Just need to give each a different Host parameter on the config stanza.
Andy Lester
Andy, according to the link I found below I needed to drop the .com from the host. Once I did that it worked fine.
radesix