Setting Your Git Commit Email Address

andrewlundydev

Andrew Lundy

Posted on August 8, 2020

Setting Your Git Commit Email Address

Exordium

Git has a feature that displays a user’s contributions (based on commits that fall into a specific set of requirements) on their public profile. I think this is great, as it gives the public (as well as potential employers or clients) a look at your programming activity. Only public contributions are shown by default, but there is also an option to account for private ones. While working on a client project, I recently ran into an issue where the work I was pushing to GitHub was not showing up on my profile.

— — —

A Simple Fix

This fix does not only apply to GitHub, but can also be used for other git services. As mentioned earlier, contributions will only be displayed on your profile if they fall within a specific set of requirements. A contribution includes issues, pull requests, and commits. Usually, to add private contributions to your profile — the only thing you need to do is enable the setting. Commits have a subset of rules that they must abide by — including 1.) The email address used for the commits is associated with your GitHub account and 2.) You are a collaborator on the repository or are a member of the organization that owns the repository.

After working with a client for about two weeks and using a private repo, I noticed that my commits were not being shown on my profile. I had confirmed that I was a collaborator on the repo, and assumed that my email account was attached to the commits being pushed from the command line. It turns out that I was wrong, but the fix was simple.

After I added a new email to my GitHub account via the web app, I failed to change it on my local machine. It’s an easy process, and as soon as I changed the email address to one that was associated with my GitHub account — the private commits started showing up on my profile.

In Terminal, you can check the current email address associated with your GitHub account by running:
$ git config — global user.email

To set the email account, run:
$ git config — global user.email “email@example.com”

There you have it — a simple mistake with a simple solution.

💖 💪 🙅 🚩
andrewlundydev
Andrew Lundy

Posted on August 8, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related