a.m
a.m

Reputation: 41

Windows Git Error 403 - Not able to push

I am having same issue as a previously posted question which was not answered: Git for Windows - error 403 access denied when pushing

I have since uninstalled and reinstalled git, and uninstalled the github desktop interface. The OLDUSER is a different github account I had for a set of files, I have deleted all of those files and am not logged into that account anywhere. The NEWUSER is my new account which I plan to use from this point forward.

I am following this tutorial to use git from the command line instead of the Windows-GitHub interface.

$ git remote add origin https://github.com/NEWUSER/REPO.git
fatal: remote origin already exists.

$ git push -u origin master
remote: Permission to CURRENTUSER/REPO.git denied to OLDUSER.
fatal: unable to access 'https://github.com/NEWUSER/REPO.git/': The requested URL returned error: 403

$ git remote -v
origin  https://github.com/NEWUSER/REPO.git (fetch)
origin  https://github.com/NEWUSER/REPO.git (push)

$ git config git user.name
NEWUSER

$ git config user.email 
EMAIL THAT BELONGS TO NEWUSER ACCOUNT

$ git config --global user.name
NEWUSER

$ git config --global user.email 
EMAIL THAT BELONGS TO NEWUSER ACCOUNT

This is my first post so I hope formatting is legible and correct.

EDIT: SOLUTION

The error was found in the credentials stored for github. The solution was initially found here but was also found here Which offers multiple ways of acheiving the same end result.

If you don't care to follow the links:

  1. Open up the windows credential manager
  2. Click on windows credentials
  3. Scroll to Generic Credentials
  4. Remove the 3 github credentials

Afterwards when attempting to push, I was prompted for my credentials (I was not prompted before) and after inputting them, the push was successful.

Best.

A

Upvotes: 4

Views: 3582

Answers (1)

nino26
nino26

Reputation: 101

I had this error as well.

I had to go to windows start browser --> control panel ---> credential manager Go to Windows Credential and see what is your username and password your computer has you signed on as.

I had to change my Username, that was why it was giving me that error. Yours says two different usernames so i think that is happening to you to.

Upvotes: 5

Related Questions