Monday, November 30, 2009

github, ssh config file and ssh-agent

Github makes use of ssh-keys for checking out your stuff via git. I also have several different keys and store them with different names such as github_rsa or some such. In order to get this to work, you have to create a config file that stores the location of the private key.

For github, in the .ssh/ directory, create a file `config` and enter in the following:
From github's help page:

Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile path-to-private-key


In several situations I've had to set up ssh keys for remote machines that only provide me with terminal access. Thus I keep getting pestered to enter the passphrase for the ssh key. ssh-agent takes care of having to keep entering in the passphrase.

After setting up the ssh-keys do:
eval `ssh-agent`; ssh-add ~/.ssh/github_rsa

It will then ask for the passphrase the one time when it adds the key to the agent, and then wont ask again.

No comments:

Post a Comment