I am working with a repo on Github. Everytime I try to push something, it asks me for my github username and password. I tried instructions on this page, namely set up the git variables github.user and github.token, but that didn't make any difference. I don't understand why this is happening.

link|improve this question

feedback

3 Answers

up vote -1 down vote accepted

You need to set-up an ssh-agent against which you only need to authenticate once. See this answer over at SO for a howto.

link|improve this answer
But this solution is for ssh-family phrases. The problem is git uses "git push" which doesn't trigger the ssh-agent, I assume. (I've already done this, so I know it doesn't work.) – picardo Oct 14 '10 at 18:27
@picardo: I've done this, and it does indeed work. – Daenyth Oct 14 '10 at 19:44
feedback

Had a similar problem today: I messed things up in my working copy, so I decided to rename the directory and clone my project again from github. But after doing that, I had to enter my password to do any pull/push request, instead of entering the passphrase just once as I used to.

That was because today I used the https protocol to clone the project! To check what protocol you're using just run

git config -l

and look at the line starting with 'remote.origin.url'.

To switch protocol:

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

Just my 2c

link|improve this answer
Awesome, this was exactly what happened to me. Thanks! – Tomasz Nov 2 '11 at 15:35
thanks I had the same issue – mnml Nov 10 '11 at 16:10
Just happened to me. Thanks. – Xeon06 Jan 13 at 20:20
1  
It worked for me. One thing is that the url does not my contain my username but the repo address as it appears on github: git@github.com:some-user/repo-name.git – B Seven Feb 15 at 7:04
This was the correct answer. Thanks! – egarcia Mar 16 at 16:41
feedback

When you set up an ssh key for github, if it's not your default key, you will need to add a section to your ~/.ssh/config

Host *github.com
    User git
    IdentityFile ~/.ssh/github_id_rsa
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.