Why github username and commit name is not the same?

Viewed 75

I have uploaded my project on github and on the website I have different username and commit name:

Image

For this post I have changed it to "NAME 1" and "NAME 2" .

Why aren't they same? I think I have changed it in the past ( because NAME 2 is familiar for me: it is my last name )and now I don't know where have I changed it. I want to change it to NAME 1 (to my github username).

I tried to change Git user.email and user.name but these have no affect to NAME 2.

1 Answers

You may check your user name and user email in your local git config:

$ git config --list

If it's different then you can change it for the next commits:

$ git config --global user.name "John Doe"  
$ git config --global user.email johndoe@example.com

The other way, you can use a special file in your repo to change a user name and email to something else

Create a file named .mailmap

And add this line:

Name 1 <name1@email.com> Name 2 <name2@email.com>

Related