PunchBird
PunchBird

Reputation: 109

Wrong user when pushing to Github from VSCode

I am new to VSCode and Github and I use Windows 10. I have 2 Github accounts, one "Private" and one "Work". I started out with "Private" but I am not using it anymore. I linked the VSCode account to "Work" and verified it has done this correctly.

Now, when I push a file from local to remote, it keeps pushing it with "Private". So I checked how to solve this and changed 2 things:

  1. In Git bash, I typed: git config --global user.name and git config user.name, and found out it said "Private" for both. So I entered: git config --global user.name "Work" and git config user.name "Work", which changed this to "Work" for both
  2. On my laptop, I went to Start -> Control Panel -> User accounts -> Manage Your Credentials -> Windows Credentials and removed the credentials for "Private"

I hoped these 2 actions would solve the issue, but unfortunately it doesn't. Is there anywhere else where I should change something?

Upvotes: 2

Views: 3073

Answers (2)

PunchBird
PunchBird

Reputation: 109

I solved the issue with help from this link provided by @Abdul: I typed git config --list, which showed an overview of the credentials cashed. There I noticed user.email was still using the email address of my "Private" account. So I typed git config --global user.email <my "work" email address> and that solved the issue - when I push now to remote it's done via my "Work" git account

Upvotes: 5

VonC
VonC

Reputation: 1323553

The user.name and user.email have nothing to do with authentication, only commit authorship.

And Windows Credential Manager is only used for HTTPS URLs.

If your remote repository is referenced with an SSH URL, said credential manager would not be involved at all.

Upvotes: 0

Related Questions