Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up SSH keys for GitHub

Tags:

github

ssh

I'm following these instructions for how to set up SSH keys for use with GitHub.

The instructions tell you to delete your current .ssh directory and create new keys in that .ssh directory. I'm unable to do this as I already have keys in my id_dsa.pub that I need to use for other servers.

Is it possible to set up SSH for GitHub while preserving the keys I already have saved in .ssh? Or is there another way to set up SSH for GitHub?

like image 480
user619804 Avatar asked May 04 '12 20:05

user619804


People also ask

Should I add SSH key to GitHub?

Using an SSH key is a convenient and secure way to access your account. It's convenient because you don't need to remember a long password. And you can make your actual password so brutally long and secure that no human or bot could guess it.


1 Answers

You can either reuse your key pair already in your directory, or create a new key-pair specifically for GitHub's use. If you decide not to use the default pair, you'll need to modify your ~/.ssh/config file and add a host definition for GitHub pointing it to the new key file. So, if your new key pair is github_rsa and github_rsa.pub, put these lines in /.ssh/config:

Host github.com
    HostName github.com
    User git
    IdentityFile ~/.ssh/github_rsa

Now, whenever you do pull or push operations to [email protected], the alternate identity file will be used.

like image 167
Dan Applegate Avatar answered Nov 29 '22 17:11

Dan Applegate