0
votes

git config shows correct user name and email and yet I cannot ever git push to my own repo on GitHub. It always says some old username that was used

git config user.name mqshaikh8

git config user.email [email protected]

git push origin master

remote: Permission to mqshaikh8/amigo.git denied to kshaikh99. fatal: unable to access 'https://github.com/mqshaikh8/amigo.git/': The requested URL returned error: 403

git remote --v origin https://github.com/mqshaikh8/amigo.git (fetch) origin https://github.com/mqshaikh8/amigo.git (push)

2
Are you using git bash/git for windows by any chance?Vivick
Yes I am using git for windowsParvez Mohammed
The user.name and user.email settings have nothing to do with authentication. They're used for creating commits, not for talking to remotes. You need to provide your HTTPS credentials or an SSH key.Chris
in any case, you should remove the old unused user config first. Then add new auth, stackoverflow.com/questions/6243407/…parlad
Does this answer your question? Remove credentials from GitDaemon Painter

2 Answers

0
votes

It happened to me quite a bit, mostly after a typo in my password and couldn't ever type a password again.

Usually installing git bash again over the old installation fixes the problem.

If you're using the default settings/windows credentials the please see this github issue on git for desktop to help you on this matter.

This SO post on how to remove git credentials might also help.

-1
votes

Finally what worked is the following:

I was logged into windows as kshaikh99. Since git integrated with windows credential manager, it had cached the kshaikh99 username and password and regardless of what's in git config user.name and user.email, it always used that credential to authenticate and that's why it was failing.

I just signed off and signed into windows as mqshaikh8. Then when I tried to git push origin master, I got a windows credential dialog box to enter my mqshaikh8 username and password. I entered that and it works with no issues.