0

I was using github account A on gitbash and I wanted to switch to B.

I deleted the credentials for github from control panel for account A and signed with B

When I run git config --list, user.email and user.name matched with account A

than I did: git config --global user.name "AccountB'sname" git config --global user.email AccountBemail

When I run git config --list , Now user.email and user.name matches with account B. And when I make a commit, It is seem to be with account B. So it's good.

My first question is: Is it all to do when changing github account on gitbash ?

2- why on my first git config --list run, name and email did not match even tho I updated credentials from control panel

  • 1
    `user.name` and `user.email` have nothing to do with your GitHub credentials, but only with what name and email will be inserted in the commit metadata. – joanis Sep 10 '22 at 14:27
  • There are probably lots of related questions here, e.g., https://stackoverflow.com/q/31187201/3216427 but I can't find a good canonical duplicate for you, so I'll post an answer here instead. – joanis Sep 10 '22 at 14:30

1 Answers1

0

Your GitHub credentials and your Git config are two unrelated things.

When you set user.name and user.email, what you are changing is the metadata that will be used in any commits your create. Creating commits is a local operation on your machine, and does not involved talking to GitHub or any other Git server.

When you want to connect to GitHub using a different account, you did the right thing: change your credentials for GitHub in the Windows Credentials Manager. That will not affect how commits are created on your machine, only how you will authenticate yourself when connecting to GitHub.

joanis
  • 10,635
  • 14
  • 30
  • 40