12

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? Commented Aug 24, 2012 at 1:36
  • Mac OS X and I think so. Commented Aug 24, 2012 at 1:47
  • I am also facing the same issue on Mac OS X Commented Nov 3, 2015 at 5:21

3 Answers 3

11

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

git remote set-url origin [email protected]:thestranger/cfinder.git 

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, that worked, I'm still wondering what the problem was though.
I'm not sure either. I've always used HTTPS for read-only access and SSH for read-write.
3

https should be supported, but you need git 1.7.10+

Comments

3

In git 1.7.1, one can change the remote from:

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

to

https://[email protected]/username/project.git 

That way, it definitely prompts for password.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.