Wednesday, May 29, 2013

Using different ssh keys for different github accounts

Mostly followed the advice from here (but it's not quite right --- see the comments).

(Note: I didn't follow the github recommended HTTPS method because I didn't feel like installing the credential helper app.)

Here are the general steps:
  • Create a new ssh key (see here for help). I named mine id_rsa_githubusername
  • Edit ssh config file (mine was at ~/.ssh/config) and add a new Host entry for each github account, ie:
Host githubusernamegit
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_rsa_githubusername
  • clone with the command: 
git clone githubusernamegit:githubusername/repositoryname