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

14,972

Solution 1

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.

Solution 2

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.

Share:
14,972
Aniket Thakur
Author by

Aniket Thakur

Hi there, I love to code and learn new things! I firmly believe that "It is your attitude rather than your aptitude that determines your altitude" and "Nothing is impossible if you give it your sincere try". My Blog - Open Source For Geeks You can also view - My Playstore Apps and My Git repositories / Gists Youtube channel Chrome Plugin All the Best! Stay in touch :) (LinkedIn Profile)

Updated on June 05, 2022

Comments

  • Aniket Thakur
    Aniket Thakur almost 2 years

    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.