We host a private gitlab repo, but I believe this is an overall git question since I've seen this behavior before.
Let's say my REAL gitlab / github / etc account details are as follows:
Username: emmdee
User Email: emmdee@my-company.example.com
So I go to some server and clone a repo, make some changes and I'm ready to commit.
If I set the username and email locally:
git config user.name "Someone Else"
git config user.email "someoneelse@example.com"
When I push a commit into the server, the above username/email is added as the commit author.
The "Someone Else" is shown as the author regardless of the fact that I needed to enter my real credentials to authenticate the push (either ssh key or user/pass).
Problem scenario case:
Team of 30 devs, maybe even some external vendors. Someone pushes some questionable code but has "spoofed" their username/email as shown above. How can I track down the actual author that made the push? (They had to have authenticated during the push action)
Questions:
- Is there a specific reason for this behavior that I'm not understanding the purpose of?
- Is there a way to view the original commit author (since they authenticated during the push either with user/pass or ssh key)
- Is there a way to disable this server-side and enforce real info to be used (or best case - just automatically use the account info used to authenticate the push)