DEV Community

Cover image for GitHub tip of the day: Keep your commit email address private!

GitHub tip of the day: Keep your commit email address private!

codewithfahad profile image Fahad Imran Updated on ・3 min read

GitHub is where developers share their code, work on open-source projects, and collaborate with others. 👨‍💻

It is one of my favorite platforms to share my work and even collaborate on school and real-world projects.

So, today I'll share a GitHub feature that I don't see many people utilizing.

📸 Viewing someone's commit email address

When you collaborate on GitHub whether it be on your own personal project or on some open-source project, your commit email address is public and is visible to everyone.

In order to see anyone's email address all you have to do it to open a commit and add .patch at the end of the URL in the browser and press Enter.

Alt Text

And viola!

The information associated with the commit will be displayed. This includes the changes made (insertions and deletions), the username of the person who made the commit and yes, the email address associated with their GitHub account.

Alt Text

In this example, I have used Brad Traversy's GitHub account as an email since his email address is already public so showing it will not have any problems (I hope 😅).

🚀 Using GitHub provided no-reply email

Now, if you are privacy conscious and don't want your email address to be public and visible to everyone, GitHub provides an option of private email address.

All you have to go is head over to the settings and navigate to Email section. Then check the Keep my email address private and the Block command line pushes that expose my email.

Alt Text

Once this setting is turned on, GitHub will remove your public email address and use a GitHub issued no-reply email address as your commit email address.

Furthermore, you can also tell GitHub to block command line pushes that use your private email address. You can see your no-reply email address in the Emails section. It will typically look like this:

your_id + your_github_username @
Enter fullscreen mode Exit fullscreen mode

Since, my username is codewithfahad, my no-reply email address is:
Enter fullscreen mode Exit fullscreen mode

💻 Configuring git to use the no-reply email address

Now all you have to do is to configure git to use the same email address. In order to do this, open git bash on your machine.

Then use the following command to configure the no-reply email address as your commit email address.

git config --global <your_noreply_email_address>
Enter fullscreen mode Exit fullscreen mode

Verify that your email address has indeed changed:

git config --global
Enter fullscreen mode Exit fullscreen mode

That's it!

git will now use the same no-reply email address as your commit email. And your personal email address will be hidden from GitHub giving you a boost in privacy.

🙏 That's all folks!

This is pretty much it. Just wanted to share this quick tip to hide your email address on GitHub. Feel free to ask any questions in the comment section. I'll be sure to answer then as soon as I can!

Thanks for reading and happy coding! 😀

🌍 Follow me around the web



Editor guide
tyu1996 profile image
Brian Ting

Great post! I never know about this thing before. Very useful!

hb profile image
Henry Boisdequin

Informative and useful!

codewithfahad profile image
topview profile image

After doing this no one can email you about a commit you suggest. Not so sure this is a good idea.