If you encounter one of these situations:
• Changing development machine
• Commits aren't showing up on GitHub contributions graph
• Not seeing your avatar next to your commits
• Getting the following github error: 'remote: error: GH007: Your push would publish a private email address'
Issue: your local Git email may not be linked to your account.
It is advisable to first verify that your username and email on your local machine match the ones used in your commits:
1. Open Git Bash / cmd
2. Check the current email and username:
git config --global user.email
git config --global user.name
3. Check the email and username used for a commit:
add .patch to the end of a commit URL, e.g.
https://github.com/octocat/octocat.github.io/commit/67c0afc1da354d8571f51b6f0af8f2794117fd10.patch
If the email and username used in your local machine and commits do not match, follow these steps:
1. Update the email and username
git config --global user.name "yourUserName"
git config --global user.email yourEmail@email.com
yourUserName = https://github.com/yourUserName
yourEmail@email.com = https://github.com/settings/emails > Primary email address
2. Confirm that you have set the email and username correctly
git config --global user.email
git config --global user.name
3. Change the email and username for all commits following the specified commit id (SHA), while maintaining the original timestamps:
cd into where your .git folder is
git rebase -i YOUR_SHA -x "git commit --amend --author 'yourUserName <yourEmail@email.com>' -CHEAD"
4. Sync changes from your local machine