简体   繁体   中英

How can I switch github user in Git Bash for Windows?

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.

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+ )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM