11

I followed the first steps after creating a repository in github, but when I got to the line: git push -u origin master it fails with this error:

user$ git push -u origin master
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/thestranger/cfinder.git/info/refs

fatal: HTTP request failed

I have remote added the correct origin url and I have git 1.7.10. The weird thing is that it is not prompting me for a username or password at all so I don't know what it's trying to use to access the repository on github. Does anyone know why it wouldn't prompt me for a password?

To clarify, the steps I followed were the ones github showed me after immediately creating the repository:

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/thestranger/cfinder.git
git push -u origin master
3
  • which OS? Do you have a SSH agent installed?
    – matt b
    Aug 24, 2012 at 1:36
  • Mac OS X and I think so.
    – Swiss
    Aug 24, 2012 at 1:47
  • I am also facing the same issue on Mac OS X Nov 3, 2015 at 5:21

3 Answers 3

10

You might try changing the URL to use SSH instead of HTTPS. In the root of your repo:

git remote set-url origin git@github.com:thestranger/cfinder.git

This will require that you have a public key registered on your GitHub account.

2
  • Thanks, that worked, I'm still wondering what the problem was though.
    – Swiss
    Aug 24, 2012 at 2:28
  • 1
    I'm not sure either. I've always used HTTPS for read-only access and SSH for read-write.
    – Brandan
    Aug 24, 2012 at 2:48
3

https should be supported, but you need git 1.7.10+

2

In git 1.7.1, one can change the remote from:

https://github.com/username/project.git

to

https://username@github.com/username/project.git

That way, it definitely prompts for password.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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