BigProgrammer_67
BigProgrammer_67

Reputation: 53

I can't switch github accounts in visual studio code terminal

I was logged previously on different account and then successfully logged out of github and logged in to my main account.

But the problem is: when I set up origin, branch, etc it pushes the commits using the credentials that I was logged in as previously.

I tried removing credentials in control panel a few times, restarting the PC and using commands to set github username and github email so they correspond to my main account. Unfortunately, it didn't work.

Every time when I remove the credentials, a windows pops up after the command git push -u origin main

Then I log in to my main account and push some changes, but the commits are not credited to my main account (which it's supposed to be), but instead commits are shown as having been done by the account that I was previously logged in to.

Upvotes: 1

Views: 151

Answers (1)

VonC
VonC

Reputation: 1323553

But the commits are not credited to my main account

  • "Main account" is about authentication (the username/password you enter in the credentials popup)
  • "commits are about authorship (see the output of git config user.name/git config user.email)

If it a local configuration of your repository (in myrepo/.git/config) that you will find the user name/email used when you create new commits.

Upvotes: 1

Related Questions