Search code examples
gitgitlabglobalcommitauthor

Gitlab shows different commit author than git config --global user.name


I know I can edit my username in gitlab but I don't want to.

I assumed that after running this:

git config --global user.name "Your Full name"

every commit will be signed by "Your Full name" but when I push commits my username from gitlab shows up instead.

When I run above command locally ( git config user.name "Your Full name" ) then "Your Full name" shows up as an author. I don't want to run this command in every repo before pushing so I am wondering how to make gitlab show username from my global config as a commit author


Solution

  • Because Gitlab decides how it displays the commits, and they have decided to use the name on the Gitlab account matching the email address. For example, this commit on Gitlab is authored by "Peter-Jan Brone" but in the Git commit the name is "PJ".

    I assume they do this to provide a consistent display of who committed what. The user.name on a commit may change. It would be confusing to show some commits as by "M Schwern", "Michael Schwern", "Michael G Schwern", "Schwern" and "MS" if they're all coming from the same account. By using the name on the matching Gitlab account, the commits can be displayed consistently.

    Using the same example above, the same email address commits to that repository as both "PJ" and "Peter-Jan Brone".

    To change what is displayed on Gitlab, you'll have to change your Gitlab profile.