7

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.

3 Answers 3

3

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.

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

3 Comments

I want to do it command line using git push origin master
@AniketThakur then check your ssh config: stackoverflow.com/a/7927828/6309
Thanks the main part was generating SSH key and storing that in your github settings. Step by step --> help.github.com/articles/generating-ssh-keys
1

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.

Comments

0

So i faced the same problem with git to push the content to repository.


Error info:

error: The requested URL returned error: 403 Forbidden while accessing https://github.com/bhanurhce/rhel6-exapmpleserver.git/info/refs

fatal: HTTP request failed


Work around for me:

This error is majorly due to the LOGIN credentials from your local machine in the git hub. You have to provide the username & password of github

Add username: $ git config --global user.name "bhanurhce" Username should be github's user account.

Confirm the username: $ git config user.name

once you try to push then it will ask for password:

$ git push -u origin master
Password:(provide your github's password.)

issue will be solved.

Even if you still get error for askpass:

Error info: [root@virtual-master git]# git push -u origin master

(gnome-ssh-askpass:47356): Gtk-WARNING **: cannot open display:

Then just solve it by command: $ unset SSH_ASKPASS

All will work fine. Hope it helps..

Thanks!!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.