Git, github remembers the wrong account

I am starting to use git and github.com. For the test, I created a repo using account1, then imported and committed the changes, clicked. Things are good. Then I created another account (account2), cloned them into another folder on my computer, making some changes, and then clicked.

Oddly enough, the git log command shows that the author who made the last push is account1, not account2. The comment is clearly the one I made from account2, but the author is flawed.

The client I use is GitBash running on MINGW32, I have already tried several times to close / restart clients, not hoping. Has anyone had the same problem? Tks

+2
source share
2 answers

Check if your global configuration user.email for account1 email address.

The email address will be the parameter on which GitHub determines the author of the commit.

See an illustration of this issue by Git author Unknown . "

As indicated in the demas answer , you need to set this information in a local git config for each repo: git config user.email ...
Thus, even if you have a global configuration, you will not have problems with identification when clicking from one or another repo.

+1
source

You can enter your email and name around the world:

 git config --global user.name 'Some Name' git config --global user.email ' some.email@gmail.com ' 

Or just set them for the current repository

 git config user.name 'Some Name' git config user.email ' some.email@gmail.com ' 
0
source

Source: https://habr.com/ru/post/1442373/


All Articles