Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

problem in pushing to github

Tags:

github

I have created a repository on github named pygame. Created a clone and added files and commited.but when I attempt to push I receive the following error:

git push -u origin master

error: The requested URL returned error: 403 while accessing https://github.com/amalapk/pygame/info/refs

fatal: HTTP request failed

I can ssh to [email protected] and receive the notice that I logged in successfully, but can't push to my repository.

like image 534
amala Avatar asked Aug 20 '11 02:08

amala


3 Answers

I recently experienced this problem when setting up a new clone of my github project.

You need to include your username in the URL to your project, in the form

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

For example, the URL provided for my test github is this:

https://github.com/jdblair/test.git

If I add my username to it, like this, then I'm able to push and pull from github with no problem:

https://[email protected]/jdblair/test.git

It is easiest to use the URL that contains the username starting from when you clone a project.

You can change the URL for an existing project like this:

git remote set-url origin https://[email protected]/project/foo/bar.git

You can use the ssh authentication instead if you want, but that's a separate setup process.

like image 178
jdb Avatar answered Nov 09 '22 15:11

jdb


Github now is asking us to use git 1.7.10 or later:

https://help.github.com/articles/error-the-requested-url-returned-error-403

like image 34
José Ricardo Avatar answered Nov 09 '22 13:11

José Ricardo


The GitHub Remote page mentions the read/write addresses for a repo:

Make sure your clone address is like:

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

And that you have defined:

git config --global user.name "Firstname Lastname"
git config --global user.email "[email protected]"

Should you use a git address (without ssh), you would also need:

git config --global github.user username
git config --global github.token 0123456789yourf0123456789token # no longer needed

(with your token coming from “Account Settings” > Click “Account Admin.”)

Update 2013: you still can generate a token (see "Creating an access token for command-line use"), but you would use it as a password for https url.

Actually, if you activate the 2FA (two-factor authentication) mechanism on GitHub, you will need a token for your https url (because your regular password would trigger the second-step verification).
See "Configure Git clients, like GitHub for Windows, to not ask for authentication"

See more at "Which remote URL should I use?".

like image 35
VonC Avatar answered Nov 09 '22 13:11

VonC