Git提交强制使用已认证用户名的问题(以GitLab为例)
Great question—this is a super common point of confusion with Git, so let’s clear it up!
There are two totally separate systems at play here: commit metadata (the name/email attached to your commits) and push authentication (how the server verifies you’re allowed to push changes). Here’s how they work:
Commit author/email is controlled by your local Git config
When you rungit commit, Git pulls theuser.nameanduser.emaildirectly from your local repository’s (or global) config file. The values you set—Someone Elseandsomeoneelse@example.com—will be embedded in the commit itself. You can confirm this right away by runninggit loglocally; you’ll see the fake name/email listed as the author of your commit.Push authentication uses your platform account (emmdee)
When you push to the GitLab server, the server checks your authenticated identity (your emmdee account) to make sure you have permission to write to the repository. But this step has no impact on the commit’s author information. The server won’t overwrite or enforce that the commit’s name/email matches your platform account—unless the repository has specific rules set up (like branch protection policies or CI checks that validate author info).
In short: Your pushed commits will show Someone Else as the author, and the push will succeed (assuming you have the right permissions with your emmdee account). The server doesn’t force the commit metadata to match your authenticated account by default.
内容的提问来源于stack exchange,提问作者emmdee

