3

I have two Github accounts, lets say accounts A and B. Account A I 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?

NGyaBoi
  • 33
  • 1
  • 1
  • 4

2 Answers2

1

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

  • Alright, I did that, will that now be tied to my actual account on Github, commits and all? – NGyaBoi Nov 12 '19 at 23:49
  • 1
    This is a global setting, which means your name will show up in every repository when you commit your projects. If you want to have a different name for one particular repository, you can cd to your work directory and type ```git config user.name "YOURNAME"``` instead of using --global – Daniel DZone Nov 13 '19 at 00:37
0

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?