2

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?

Alex028502
  • 3,486
  • 2
  • 23
  • 50
PunchBird
  • 89
  • 9
  • Windows user accounts are unrelated to GitHub user accounts. Why do you expect changing the former to have any effect on the latter? – IInspectable Jul 11 '21 at 08:15
  • 1
    Check out this link it may help https://stackoverflow.com/a/53605623/10705348 – Abdul Jul 11 '21 at 08:17
  • @IInspectable, that's not true it's using Windows Credentials for HTTPS Urls, see also comments in link provided by Abdul – PunchBird Jul 12 '21 at 09:09

2 Answers2

5

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

PunchBird
  • 89
  • 9
0

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250