GitHub uses the email saved in a commit's header to link the commit to a GitHub user. If you find your commits are being blamed on another user, or not linked to a user at all, you should check your settings.
Tip: Commit blame does not grant access to a repository. If you are seeing commits blamed on a user you do not know, don't worry. The user does not have access to your repository unless you've explicitly added them as a collaborator on that repository or to a team that has access to the repository.
In order for GitHub to properly blame you for your commits, make sure your git email setting is correct and matches an email attached to your account.
To check your git setting, run this command:
git config user.email # firstname.lastname@example.org
If this email is not correct, you can change the global setting:
git config --global user.email "email@example.com"
Tip: If you work on multiple machines, you will need to check this setting on each one.
If your email is not attached to your GitHub account you will need to add it for your future commits to be blamed correctly.
- In the user bar in the top-right corner of any page, click Account Settings.
- Click "Emails".
- Click "Add another email address".
- Enter the email address and click "Add".
You may also want to verify your email with GitHub for added security.
If you used an invalid email, or an email that's already attached to another account, then your previous commits will not be blamed correctly. While Git does allow you to modify the repository's history and correct this, we strongly discourage changing commits that you've pushed to a remote repository. Visit this article for more information on changing this information.
If your previous commits used the correct email, they will start to link after you add the email to your account. However, it may take some time for the old data to fall out of the server's cache before this happens.
Moving forward, if your settings match, then all your new commits will be blamed on you and linked to your account.