Pushing to Git returning Error Code 403 fatal: HTTP request failed

janac
2 min readSep 8, 2021

Are you seeing this error after running git push

error: The requested URL returned error: 403 Forbidden while accessing https://{yourusername}:{password}@github.com/yourRepo/ fatal: HTTP request failed

Note that 403 means is an HTTP code that means forbidden. It implies that your URL exists, the server is working, but there are some access/permission issues. It could be authentication or authorization.

Luckily, there are solutions that can surely solve your issue. Please try each of them, and if none work, leave a comment and I will personally help you solve it!

1. Make sure the password is correct

Self-explanatory, but in order for us to narrow what your particular issue is, we need to start with the basics. Make sure that your password is correct. You can check what password you are using in the .git/config file in your repo’s root. If there is no password there, then you are likely using key-based authentication.

2. Create an Access Token

  • Ensure all of the checkboxes are selected
  • Copy the access token, and use it in place of your password.

3. Clear Stored Credentials

The error may be, the computer has saved a git username and password so if you shift to another account the error 403 will appear. Below is the solution
For Windows you can find the keys here:

control panel > user accounts > credential manager > Windows credentials > Generic credentials

Next, remove the Github keys.

On macOS
1. In Finder, search for the Keychain Access app.

2. In Keychain Access, search for github.com.

3. Find the “internet password” entry for github.com.

4. Edit or delete the entry accordingly.

Conclusion

If none of these worked, leave a comment! I respond to all comments and will find a solution for you.

--

--

janac

Most of my writing is about software. I enjoy summarizing and analyzing books and self-help videos. I am senior software consultant at LazerTechnologies.com.