Why the commit user differs from the account name
This article explains why the user associated with a commit might not match the Alibaba Cloud DevOps account name and how to prevent commit spoofing.
Why commit users and accounts differ
Git derives a commit's author and committer information from the custom user.email and user.name values in your git config. Because these values can be customized, a commit's author can be spoofed to impersonate anyone.
Codeup displays committer information on the commit list page based on the following principles:
How commit users are identified
First, Codeup tries to exactly match the user.email from the Git commit with the primary email address of the logged-in Alibaba Cloud DevOps account (for local pushes, you configure this email in your local git config). If the email addresses match exactly (case-sensitive), Codeup attributes the commit to the current user. To ensure accurate contribution statistics, set your local user.email to be identical to your primary email address in Alibaba Cloud DevOps. This match must be case-sensitive to prevent attribution errors.
Codeup supports push rule checks. If the code ownership check is enabled and the email address in the commit information does not match the primary email address of the server-side Alibaba Cloud DevOps account, the commit is rejected. For more information, see Push Rule Settings.
If a commit's email does not match the primary email address of the current Alibaba Cloud DevOps account, Codeup directly displays the user.name from the commit. As a result, you might see committer or author names that do not belong to your organization. This does not mean an external user has modified your organization's repository.
To standardize commit information, you can enable the code ownership check to ensure that commit information is consistent with your Alibaba Cloud DevOps account.
If you import an external repository, such as one from an open-source project, its commit history may contain commits from non-organization members. Commit records from these external contributors are expected in this case.
How to prevent commit spoofing
If an attacker steals a user's credentials and configures their email address to maliciously spoof commits and push malicious code, use GPG to locally sign your commits or tags. Codeup verifies these signatures to ensure that commits and tags come from a trusted source. For details, see Prevent commit spoofing with GPG signatures.