Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure command line git to use ssh key

When I do git pull via the command line, it always asks for my github username and password. I'd like to tell it to use the ssh key in github, and never have to worry about it again. How do you do this?

like image 793
tyler Avatar asked May 08 '14 16:05

tyler


1 Answers

Assuming that you have used ssh-keygen to generate a key pair and uploaded the public key in the appropriate place in your github account, you should be able to set remote to use the url [email protected]:username/repo.git.

git remote set-url origin [email protected]:username/repo.git

If you do not have local changes that you care about, you can just delete your local repository and clone again:

git clone [email protected]:username/repo.git

Here are github's instructions on this setup, which you can use as a reference as needed.

like image 50
merlin2011 Avatar answered Sep 23 '22 17:09

merlin2011