0

I have updated the git creds using these commands

git config --global user.email myemail@gmail.com

git config --global user.name myusername

But when I pushed the code it is also showing the system name in the commit as well. How can I change it to my name?

Edit: Output of the git log -n 1

Author: MySystemName <XXXX>   // this is exact what I get in git commit
Date:   Sun Apr 2 20:54:31 2023 +0530

Thanks

1 Answers1

3

How can I check that or set that?

Go to your repository folder, and type:

git config -l --show-origin --show-scope

You will see all settings, with their scope and location. If there is one closer to the repository with your system name, it would take precedence over the global settings.

Check also for user environment variables, like "Committing":

  • GIT_AUTHOR_NAME is the human-readable name in the “author” field.
  • GIT_AUTHOR_EMAIL is the email for the “author” field.
  • GIT_COMMITTER_NAME sets the human name for the “committer” field.
  • GIT_COMMITTER_EMAIL is the email address for the “committer” field.

Those would also take precedence over the global settings.


For existing commits, you can use git filter-repo (to be installed first) "User and email based filtering":

cd repo
git filter-repo --mailmap my-mailmap

with my-mailmap:

Correct Name <correct@email.com> <old@email.com>
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250