1

I have two GitHub accounts and want to push to a repository with one of them, lets call it account A.
But the thing is my Git Bash for Windows always push with the other, the account B.

I believe that happens because the first time I downloaded Git Bash (long time ago) I configured my user to be the account B, but I can't figure out how to switch them.

I unistalled Git Bash and installed again, this time with no credential help feature and even went to Control Panel and excluded the generic credentials regarding GitHub but still, everytime I commit, it is with the B account.

In fact, after I reinstalled and excluded the generic credentials, the Git Bash asked me to enter my Git user and password before pushing, I entered my account A and, surprise surprise, in the end the commit was still made with account B.
I really don't know what to do.

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

1 Answers1

2

The commit "made as B" have nothing to do with user credentials.

Those commits author are from git config user.name/git config user.email

Change those settings in your repository, and you will see new commits pushed as B.

As Philippe suggests in the comments, you can also manage different user identities through conditional .gitconfig files (with Git 2.13+)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • And I could add that if you have this problem for multiple repositories, you could have a look at 'conditional include' in '.gitconfig' file. – Philippe Jan 15 '21 at 00:16
  • @Philippe Good point. I have included your suggestion in the answer for more visibility. – VonC Jan 15 '21 at 07:11