Reputation: 221
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.
Upvotes: 22
Views: 28652
Reputation: 597
Committing to github from server this is what worked for me in the terminal or git bash
To create a remote to github.com try:
git remote add origin https://put your username [email protected]/put your git username here/put your repository name here
To change the remote just do:
git remote set-url origin https://put your username [email protected]/put your git username here/the name of your repository here
Upvotes: -1
Reputation: 1323115
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?".
Upvotes: 11
Reputation: 24952
In my case getting rid of such error message was resolved this way: Person was simply added to github repository as a colaborator. Thats it - error vanished magically.
Upvotes: 1
Reputation: 559
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.
Upvotes: 27
Reputation: 6082
It's all in the remote
.
Change your current remote from https://github.com/amalapk/pygame.git
to [email protected]:amalapk/pygame.git
and enjoy.
To do this... (assuming your current remote is called origin)
git remote set-url origin [email protected]:amalapk/pygame.git
Upvotes: 6
Reputation: 1489
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
Upvotes: 12
Reputation: 1870
Please follow the instructions on http://help.github.com/create-a-repo/
You have cloned your repository with the public read only url.
RTFM
Upvotes: -4