1

I have been pushing to a public repo for a long time, everytime when I do git push, I didn't have to enter username/password, the pushing process just happened instantly when I hit Enter.

Today I want to push my project to my private repo, after adding my private repo to my remote using git remote add private <url>,I tried git push but a fatal error came out and said "authentication failed, invalid username or password".

I mean, I couldn't even enter my username or password, so the username or password I have right now is probably for my public repo. So how do I make git to let me enter username and password again?

L. Z.
  • 92
  • 1
  • 8

1 Answers1

2

You probably enabled Git Credential Manager when you installed git or the first time you pushed to a repo. Git Credential Manager caches and re-uses credentials between different push commands, so it could be re-using credentials for a different remote. Without credential manager, you would have to type in your credentials on every push.

Please follow the advice in this SO post to clear your credentials. Note the 2nd answer is specific to Windows Devices, whereas the first should work for MacOS and Linux.

nareddyt
  • 1,016
  • 10
  • 20
  • 1
    Thanks. This solved the problem like magic. Removing the credential from the vault did prompt me password entry for me. – L. Z. Jan 01 '19 at 05:14