Mohatta
← Articles

Your GitHub Commits Can Expose Your Email

December 2, 2026 · DevOps · 2 min read

Warning

Your GitHub commits can expose your email.

Did you know that anyone can see your email from your public GitHub commits?

Replace <username>, <repo> and <commit-id> with your own values.

1. How people can see your email

Open a public commit on GitHub and add .patch to the end of the address:

https://github.com/<username>/<repo>/commit/<commit-id>.patch

Example:
https://github.com/mohattadev/mohatta-dotnet-starter-kit/commit/1234567.patch

Sample result:

From 1234567 Mon Sep 17 00:00:00 2001
From: Mohatta <mohatta@example.com>
Date: Wed, 2 Dec 2026 09:30:00 +0700
Subject: [PATCH] docs: update README

Anyone who clones the repository can also see it with git log. Someone could collect your email and use it for spam or phishing.

2. Hide your email on GitHub

  1. Go to Settings → Emails.
  2. Select Keep my email addresses private.
  3. Select Block command line pushes that expose my email.
  4. Copy your noreply address.

Format:

ID+USERNAME@users.noreply.github.com

Example:

00000000+mohattadev@users.noreply.github.com

3. Update Git on your computer

Choose one option.

All repositories on your computer:

git config --global user.email "<your noreply address>"

Only the current repository (run it inside the repository folder):

git config user.email "<your noreply address>"

Sample:

git config --global user.email "00000000+mohattadev@users.noreply.github.com"

Then check which email Git will use in the current folder:

git config user.email

A repository setting overrides the global one.

4. Commit and push

After you commit and push, your new commits on GitHub will show the noreply address:

From: Mohatta <00000000+mohattadev@users.noreply.github.com>

Note

This applies only to new commits. Old commits still show your old email.

What about old commits?

Option Good Bad
A. Leave them Nothing can break Your old email stays visible
B. Rewrite the history Keeps your commits with the new email Commit IDs change, and others must clone again
C. Start a new repository Simple You lose history, issues, pull requests and stars

Option B: rewrite the history

Use git-filter-repo to change the email in your old commits. Read its guide and follow the steps for your system.

Caution

Back up first and tell your team. Old copies can still exist in forks, clones and GitHub’s cache.

Option C: start a new repository

Delete the old repository or make it private. Otherwise, the old email stays visible there.

Which option do you prefer: A, B or C?

TagsGit GitHub Privacy

Discuss this on LinkedIn(opens in a new tab)