Replace this template with your information
Describe your question in as much detail as possible:
- What are you seeing, and how does it differ from what you expect to see?
what happens:
git push via ssh attributes commit to a different user’s name. That different user doesn’t even have an ssh key, but their email address is similar to mine because I set it up as an automation account and it had to have some email address.
e.g.
I commit via git push using ssh key of user@foo.bar.com. Commit in gitlab web UI shows update was made by “automation” instead of “user”
what should happen:
git push as user, commit shows update from “user”
-
What version are you on (Hint: /help
) ? and are you using self-managed or gitlab.com?
self-managed from Docker image gitlab/gitlab-ee:12.9.2-ee.0
using local filesystem for git storage.
-
What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?
Searched these forums and gitlab.org issues and found an issue reporting this similar kind of problem that had been closed out due to inactivity 3 years ago.
Confirmed that git commit on client local repository (where the git push is executed) has
Author: User <user@foo.bar.com>
Hey, have you set your git config user.name
and user.email
values on your development machine?
SSH keys are only used for read/write authorization and not for identification. well… it is identification, but not for your display name and email.
Git doesn’t really work that way… You have a copy of the repository on your development machine, you modify stuff and then create a new commit. No authentication / confirmation is needed for that commit to be valid / approved. The authentication is needed when uploading your changes to a centralized repository (Gitlab in this case).
For example, I can now create a new commit to practically any repository with your name and email set. This is also why the GPG keys exist. If a commit is signed with a GPG key, it means that the identity is also verified.
You have SSH keys for read/write authorization and GPG keys for “display metadata” verification.
TL;DR;
You probably haven’t set your global git config options.
Do that by executing the following commands on your development machine ( replace the name and email values )
git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email "MY_NAME@example.com"
From now on, all commits you create will have this metadata set in them.
I hope I was able to help you resolve this issue of yours. If it is resolved, please mark my reply as the solution.
if you have any more questions feel free to ask
Kind regards.
1 Like
I do have these in my ~/.gitconfig:
[user]
name = Case Larsen
email= <my-email-address>
in the above example, the email address corresponds to user@foo.bar.com
and in the git commit in the local repository copy, the following information shows:
Author: Case Larsen <user@foo.bar.com>
however the attribution in the gitlab web UI is for the user with email address user+automation@foo.bar.com
Sorry, is the foo.bar.com
the same as the Gitlab domain ? because in that case, it might be the fact that the option of hiding user addresses is enabled.
I am finding a similar situation, feels like a bug in gitlab.
On my initial commit to a branch it shows as me that pushed the commit - on every subsequent commit it shows as an entirely different user.
I have the user.email and user.name set up correctly, and neither are similar to the other user (my email is completely different than the gitlab domain too).
One thing I noticed is that the gitlab user id for me is 29 and the other user is 129. Could it be that it is searching for “contains” instead of an exact match or something?