1

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

a.m
  • 11
  • 3
  • 3
    Possible duplicate of [Remove credentials from Git](https://stackoverflow.com/questions/15381198/remove-credentials-from-git) – phd Jan 30 '18 at 22:33
  • 1
    Yup. I was just going to respond, when I saw that you already found the answer. Windows Credentials Manager was the culprit; deleting the entry and allowing Git to prompt you to re-enter username and password is the solution :) – paulsm4 Jan 30 '18 at 22:38
  • 1
    You should post your solution as an answer to the question, instead of editing it into the question. Even better would be to post the answer on the question you linked instead of creating a duplicate question. – nloewen Jan 30 '18 at 22:48

1 Answers1

2

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.

nino26
  • 31
  • 3