Git requires you to identify yourself with your email address in order to make commits. For your privacy, you can use a private address instead of your real email address.

GitHub does not get many reports of spam being sent to Git commit email addresses, but if you are worried about it, you can choose to hide your email address anyway.

There are two situations where you'll want to hide your email address:

  • Making commits on directly.
  • Making commits through the command line or a native app.

Hiding your email address for commits on the website

Hiding your email address for commits made on the website affects various parts of the GitHub Flow, like creating, editing, and deleting files, as well as merging pull requests. Enabling this feature sets your email address to <username> for these activities.

  1. In the user bar in the top-right corner of any page, click Account Settings. Account Settings button
  2. Click "Emails" in the sidebar Emails tab
  3. Click Keep my email address private
    Private email checkbox

Hiding your email address for commits made through your computer

Instead of using your full email address (e.g., you can configure Git's "" setting to use your <username> address, which will still serve as a unique identifier for you. Your commits will properly be linked to your GitHub account.

To set your private email address, run the following from the command line:

git config ""
# Set your email address to the private version
git config
# Verify the setting

You can also provide a special --global flag, which makes your email address the same across every local Git repository on your computer. For example:

git config --global ""
# Sets your private email address across every local Git repository


Commits on GitHub aren't linking to my account

Make sure that email address associated with your GitHub account is the same email address used by Git. It may take some time for old commits to fall out of GitHub's cache, but any new commits should link up immediately. You should also [verify your email address on GitHub][verify-email].

New commits aren't using the right email

If git config reports the correct email address for the repository you're viewing, but your commits are using the wrong email address, your environment variables may be overriding your email address.

Make sure you have not set the GIT_COMMITTER_EMAIL or GIT_AUTHOR_EMAIL variables. You can check their values with the following command:

# prints the value of GIT_COMMITTER_EMAIL
# prints the value of GIT_AUTHOR_EMAIL

If you notice a different value, you can change it like so:

My old commits still have my old email address

Changing your email address in Git only affects commits that you make after your change.

To rewrite your old commits, you can use git filter-branch to change the repository history to use your new email address.

Warning: If you're collaborating on a repository with others, it's considered bad practice to rewrite published history. You should only do this in an emergency.

Further reading