Commits not showing up on GitHub contributions graph
My articles are for beginners who don’t know much about programming, I’m trying to explain things as simple as I can without using a lot of technical words.
I recently formatted my MacBook Pro, set up my development environment and pushed some changes to a personal project that I’m currently working on. Surprisingly, all my new commits were not showing on my contributions graph! How frustrating is that?
After skimming through GitHub’s documentation, I found that commits will only appear if they meet the conditions below:
- Criteria 1: The commits were made in a standalone repository, not a fork.
- Criteria 2: The commits were made: In the repository’s default branch (usually master) or In the gh-pages branch (for repositories with project sites)
- Criteria 3: The email address used for the commits is associated with your GitHub account.
So if you meet the Criteria 1 and 2, you probably have a mismatch between your local Git email address and the email on your GitHub account.
Ok ok, so how do I fix that ?
Step 1: On your Github account Go to Settings section located on the top right corner of the page or you can simply navigate to the following url -> https://github.com/settings/profile
Step 2: Then go to the Emails Section
The Primary email address should match the one on your local Git.
“Ok, so how do I know my local Git email address ?”
Step 3: On your local machine, open terminal and run the command below
git config --global user.email
Result:
git config --global user.email
soufiane.dev@example.com
In my case, I had a mismatch between the two email addresses:
- My local git email was soufiane.dev@example.com
- My remote Github email is soufiane@example.com
That explains why my commits are not showing on my contributions graph.
Step 4: Run the command below to change your local Git email address to match your GitHub account email address.
git config --global user.email "YOUR_GITHUB_EMAIL_ADDRESS"
Now, both addresses should match.
Step 5: Run the command below to confirm that you have set the email address correctly in your local Git:
git config --global user.email
Step 5: All set! Now you can commit and push your changes to Github and it will show on your contributions graph!
I hope this helps! Comment down below if you have any questions.