In this post, we will look at what happens when you are trying to push from Visual Studio Code to a GitHub repo and the wrong user is being passed, thereby giving you the error that you do not have permission to post to this repository.
The remote branch I am trying to push to is on my account carldesouzacom:
And in Git in Windows, it thinks I am using a different user.
In VS Code, I have signed in using the account I want:
But when I push, it thinks I am a different user, in this case, carldesouza – “e: Permission to carldesouzacom/my-linter-test.git denied to carldesouza.
fatal: unable to access ‘https://github.com/carldesouzacom/my-linter-test/’: The requested URL returned error: 403”:
In order to resolve this, go into Windows and go to Control Panel, then search for the Credential Manager. Then delete the GitHub credentials. You may notice that some of these credentials are in fact using the GitHub user you do not want to authenticate with.
Once removed, run the command to push to your GitHub repo, e.g.
git push –set-upstream my-linter-test main
You will be prompted to log in:
And click Allow:
And Continue:
And grant access.
You will now be able to push to GitHub.
I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.
IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.
THANK YOU, AND LET'S KEEP LEARNING TOGETHER.
CARL
Hi Carl 🙂
I’m having a similaire issue, so I tried your fix.
Vscode is logged on a wrong username, so I removed as you asked, this credential.
After doing this, instead of saying “XXX have not access to XXX”, my error message is
remote: Invalid username or password.
fatal: Authentication failed for ‘https://github.com/XXX/XXX’
I can’t find anyone with the same issue. Do you have any idea of what is going on?
After few hours of fighting, I finally found the problem:
At the bottom left corner, we can find a VSCode tool, where you can manage accounts (it’s a little guy)
In this tab, you can right click -> disconnect accounts you don’t want.
If you can’t see this tab, right click on the left bar, and click on “Account”.
(Sorry for my terrible english)
Thank you so much !
Finally found it 😀
After few hours of fighting, I finally found the problem:
At the bottom left corner, we can find a VSCode tool, where you can manage accounts (it’s a little guy)
In this tab, you can right click -> disconnect accounts you don’t want.
If you can’t see this tab, right click on the left bar, and click on “Account”.
(Sorry for my terrible english)
Hello.
What if your using a Kali Linux or Ubuntu terminal instead?
The windows credential manager doesn’t really count to Ubuntu and hence the same solution doesn’t suffice on that platform as well
How can one navigate through the same?
Finally fixed the problem. Thanks a lot!