GitHub Noreply Email for Git Commits: Set It per Account
Use your GitHub noreply address as user.email: ID+USERNAME@users.noreply.github.com. Set it per account, per folder, and your real email never lands in a public commit. With several accounts, the hard part is not the address, it is making sure each repo uses the right one.
What is the GitHub noreply email address?
Every GitHub account gets a private address that GitHub maps back to your profile. Accounts created after July 2017 use the ID-based form:
12345678+yourname@users.noreply.github.com
Older accounts may use the plain yourname@users.noreply.github.com. You can find yours under Settings → Emails, with “Keep my email addresses private” enabled. Commits made with this address still count toward your contribution graph.
Why does a real email in commits matter?
Git writes the author email into every commit, and it is public in any public repo, forever. Rewriting it later means a force-push, as covered in Fix Wrong Email in Git Commits. It is far cheaper to never leak it.
With two accounts it gets worse. Your personal address ends up in a client’s history, or your work address in a side project.
How do I set the noreply email for one repo?
Inside the repo:
git config user.email "12345678+yourname@users.noreply.github.com"
git config user.name "Your Name"
Check what Git will actually use:
git config --show-origin user.email
The output tells you which file set the value, which is the fastest way to spot a global setting overriding what you meant.
How do I use a different noreply address per account?
Put one config file per account and load it by folder with includeIf:
# ~/.gitconfig
[includeIf "gitdir:~/work/"]
path = ~/.gitconfig-work
[includeIf "gitdir:~/personal/"]
path = ~/.gitconfig-personal
# ~/.gitconfig-work
[user]
name = Your Name
email = 87654321+work-handle@users.noreply.github.com
Mind the trailing slash in gitdir:, and the order: later matching blocks win. The traps are listed in Git includeIf: Different Email per Folder.
Can GitHub block pushes that expose my email?
Yes. In Settings → Emails, GitHub offers an option to block command line pushes that expose your private email. If a commit carries your real address, the push is rejected instead of leaking it. Treat it as a safety net, not a setup: the push fails after the commit is already made, so you still have to amend.
What does noreply not fix?
The email is only one of four layers. The SSH key, the gh session and commit signing can still belong to the wrong account. A noreply email with the wrong signing key gives you the “Unverified” badge, see GitHub Unverified Commits With Multiple Accounts.
Hats moves all four together. Bind a folder to a profile and the commit identity, SSH key, gh account and signing follow, and the guard blocks a push made under the wrong hat. It is free, macOS 14+, and installs with brew install --cask xorbeta/hats/hats.
FAQ
Does the noreply address hide my name?
No. The name comes from user.name. Only the email is replaced.
Will my old commits change?
No. Only new commits use the new address. Old ones need a history rewrite.
Do I need a different noreply address per account?
Yes. Each GitHub account has its own, with its own numeric ID.
How do I check the email of the last commit?
Run git log -1 --format='%ae'. It prints the author email of the latest commit.