I worked alone on a project versioned on Github, so for convenience I put something like this in my ~/.git/config file:
url = https://[email protected]/COMPANY/PROJECT.git
This way git asks only for password on pull/push. But now more people have to push and pull, so we thought this would make git ask also for user name:
url = https://github.com/COMPANY/PROJECT.git
But instead git asks for nothing now and this is a sample result of git pull:
error: The requested URL returned error: 403 while accessing https://github.com/COMPANY/PROJECT.git/info/refs
fatal: HTTP request failed
How can git be forced to ask for user name and password as expected?
You can avoid being prompted for your password by configuring Git to cache your credentials for you. Once you've configured credential caching, Git automatically uses your cached personal access token when you pull or push a repository using HTTPS.
No, your user.name does not matter. However your user. email should match one of the addresses in your GitHub settings.
I work on some different servers now and I've noticed that this issue affects git 1.7.0.4, but not the newer 1.7.9.5. So anyone experiencing the same problem should upgrade their git if possible.
@jszakmeister suggested asking the git mailing list, but having read this stackoverflow thread and this github page I think there's no point, it looks like a known problem without a good known solution. Github say they recommend git 1.7.10 and people in the stackoverflow discussion suggest things that don't really solve my problem. So I guess the only option is updating your git - let consider that the solution and this question answered.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With