Github push to upstream 403 error with https

So, It's not always easy to set up a project with EGit for Eclipse, but once you have it set up, you are happily rockin' away.

I have not set up the ssh keys yet, so I want to use https.  For some reason when you add the remote with EGit, it does not properly add your github user name to the configuration.  So I have used this as a workaround.

Here is the error:


$ git push -u origin master
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/jesslilly/aggalg.git/info/refs

fatal: HTTP request failed

Here is the fix.  Note that I have added my github user name and the at symbol.

$ git remote add origin https://jesslilly@github.com/jesslilly/aggalg.git

$ git push -u origin master
Counting objects: 16, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (16/16), 1.47 KiB, done.
Total 16 (delta 1), reused 0 (delta 0)
To https://jesslilly@github.com/jesslilly/aggalg.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

Negatives of this approach: You have to enter your password each time you push.

Comments

  1. I should note... This may not be a problem if you save your user / password in Eclipse secure storage. (which I do not do)

    ReplyDelete
  2. Just wanted to let you know this really helped me out for my linux terminal, too. Nowhere does anyone properly state that you need to set your origin to https://accountname@github.com/... instead of https://github.com/, which to me was key.

    Not exactly what you were solving, but wanted to point out that you provided some information that's not exactly widely available.

    ReplyDelete
  3. Thanks @Alitoh! Glad to help. I think you would not have the problem if you set up the ssh keys correctly. Then you don't have to enter your password. https://help.github.com/articles/generating-ssh-keys. But this will work for you! Have a good weekend!

    ReplyDelete
  4. Thanks Jess. It was a life saver. I have been facing the same problem since many days. I was not able to add SSH keys to Github since the "Add SSH Key" button is not working due to some Cross Origin Resource Sharing violation of the required js file. This technique saved the day.

    Once again, thanks a ton.

    ReplyDelete
  5. After a couple hours of frustration, I found your post and it solved this problem for me. Thank you much!

    ReplyDelete
  6. You just saved me a ton of frustration! Many thanks!!!

    ReplyDelete
  7. This web site is known as a walk-through for all of the info you wished about this and didn’t know who to ask. Glimpse here, and also you’ll positively discover it. best online casinos

    ReplyDelete

Post a Comment

Popular Posts