Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: The requested URL returned error: 403 Forbidden while accessing

I have a git repository . I have a GUI client in Windows and EGit in Eclipse ADT. Generally I edit in Eclipse ADT and use the GUI Client to update the Github repo. First I commit (which creates a buffer) and then when I sync it uploads it to my actual repo.

Now I have clone my repo on Linux(CentOS 6.4). Everything is setup. I changed some file. Then I used git add and git commit -m "message" -a command and it worked fine. But my actual github repo was not updated. After bit of googling I figured out that we have to explicitly provide git push command. After which I am getting

[aniket@localhost Android]$ git push
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/aniket91/Android.git/info/refs

fatal: HTTP request failed

What is going wrong? There is no firewall or proxy and I have close by iptables service. Has anyone encountered this scenario before? What should be done?

After following this answer (which kind of worked I got following error)

[aniket@localhost Android]$ git push origin master
The authenticity of host 'github.com (192.30.252.130)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.130' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Any suggestions are appreciated.

like image 315
Aniket Thakur Avatar asked Nov 01 '13 07:11

Aniket Thakur


2 Answers

The answer you mention suggests to change the url from an https one to an ssh one.

That would only work if you have a ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub, with the latter (public key) published in your GitHub ssh keys.

Check your Egit ssh configuration.

http://wiki.eclipse.org/images/8/87/Egit-0.6-003-SshPreferences.png

For step by step procedure as of how to generate SSH key and set it in your GitHub setting here is the link.

like image 62
VonC Avatar answered Oct 29 '22 19:10

VonC


I had the same problem and the cause was that I was using https git access under my linux box. Pull was ok, while push ended with error. The solution was to switch to ssh access, ex:

So first read remote url:

$ git config --get remote.origin.url

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

if you see https then change it to ssh, copy proper url from your github project www, and call:

$ git remote set-url origin [email protected]:yourname/project.git

you might still need to put (and maybe also generate) .ssh public key to github. For that look into VonC answer.

like image 1
marcinj Avatar answered Oct 29 '22 19:10

marcinj