Wrong User When Pushing To GitHub from Visual Studio Code

Leave a comment

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.

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
 

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

https://www.youtube.com/carldesouza

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

Your email address will not be published. Required fields are marked *