Pushing to Git returning Error Code 403 fatal

If you're using multiple github accounts then that could also be the cause of the problem. Git saves the username and password you use first in your OS's credential vault. Any subsequent requests will be using those details regardless of what your IDE tells you.


You have to either use https and enter your password or use ssh (and associate your public ssh key to your github account)


This may solve your problem:

git remote set-url origin https://username:[email protected]/user/repo.git

I tried my best and looked for the causes/solution of the error:

Error: The requested URL returned error: 403 while accessing
https://github.com/Joey-project/repo.git/info/refs
fatal: HTTP request failed

I believe one of the main reasons of this happening is because of bad login credentials from your local machine to the server.

If I remember correctly, one has to

(1) Make sure you have a stable git version

(2) Ensure the remote is correct

(3) Provide access token if 2FA is enabled

(4) Checking your permissions(username/password)

(5) Use ssh instead of https

Pushing to Git returning Error Code 403 fatal: HTTP request failed might come in handy, which has a lot of extra information regarding your problem.

Goodluck! I hope it helps you