Pushing to Git returning Error Code 403 fatal: HTTP request failed
To definitely be able to login using https
protocol, you should first set your authentication credential to the git Remote URI:
git remote set-url origin https://[email protected]/user/repo.git
Then you'll be asked for a password when trying to git push
.
In fact, this is on the http authentication format. You could set a password too:
https://youruser:[email protected]/user/repo.git
You should be aware that if you do this, your github password will be stored in plaintext in your .git directory, which is obviously undesirable.
I just got the same problem and just figured out what's cause.
Github seems only supports ssh way to read&write the repo, although https way also displayed 'Read&Write'.
So you need to change your repo config on your PC to ssh way:
- Edit
.git/config
file under your repo directory. - Find
url=
entry under section[remote "origin"]
. - Change it from:
url=https://[email protected]/derekerdmann/lunch_call.git
to:url=ssh://[email protected]/derekerdmann/lunch_call.git
That is, change all the texts before@
symbol tossh://git
- Save
config
file and quit. now you could usegit push origin master
to sync your repo on GitHub.