Saturday, August 31, 2013

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.