简体   繁体   中英

How do I change git login for command line on Windows?

I have two Github accounts, lets say accounts A and B. Account AI just deleted, so I can use B instead. B is on an organization which doesn't include A. I recently started using git in cmd, but whenever I do a commit to a repo on said organization, it shows up as A, not B. I am guessing cmd is still using A's credentials.

How do I change this?

If my guess is right, it is because your global name is still account A.

you can type: git config --global user.name to check the name.

If it is still your old account's name, use command: git config --global user.name "YOUR NAME" to change it:)

It sounds like you'd like to overwrite the old username and email address attached to git. It's really quick to overwrite the old value or even check it in the command line.

  1. Use: git config --global --list

    should output current username/email for git

  2. Use: git config --global user.name 'DesiredUserNameHere'

    Now you can run the first script to see if this sticks. Next Email!

  3. Use: git config --global user.email 'DesiredUserNameHere'

    Now you should have completely updated your username and email.

More info can be found here, also on Stackoverflow

How to change my Git username in terminal?

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