How to set up GitHub to not have it constantly ask for your username and password

When you start using github from the command line a lot, you will find that it is very annoying to constantly have to enter your username and password. In the long run, it is better for you to set it up such that you are not asked for your credentials everytime. See this simeple how-to to set up SSH keys that take care of this for you.

 

How to Setup GitHub to not have it constantly ask for your username and password from the Command Line

A quick google search brought me to stackoverflow post about ssh keys, which led me to the next step posted on github.com

 

 

Here is a condensed version of what these posts describe:

 

1. change the url used to access github (may be different for other source code hosting services)

git config remote.origin.url git@github.com:your_username/your_project.git

 

2. generate an SSH key to associate it with my github account

cd ~/.ssh
ssh-keygen -t rsa -C "your_email@example.com"

 

3. copy the (just created) rsa public key to my github account

 

pbcopy < ~/.ssh/id_rsa.pub

 

Now add the SSH Key online via the github web interface

 

4. If this is a second identity (check by ssh-add -l) then you need to add the private key locally

ssh-add ~/.ssh/id_rsa

 

5. Test everything out (using your rsa key passphrase)

ssh -T git@github.com
Show comments 0