Email privacy error

How to resolve GH007 remote errors related to private email addresses.

When trying to push a commit using git from the command-line, you receive a GH007 remote error:

remote: error: GH007: Your push would publish a private email address.

Here, you’ve likely:

  • Configured your local copy of git to use the email address associated with your GitHub account
  • Enabled the Keep my email addresses private option in your Github profile settings.

The error is Github’s way of enforcing the privacy of your email address.

To fix things, you can:

  • Configure git to use your noreply email address (displayed in GitHub email settings) (Preferred)
  • Deactivate email privacy (Not recommended)

If you choose the former, you also need to reset the commit to use the noreply address.

Here are the steps:

  1. Use Github email settings to determine your noreply address. (Consider coping it to the Clipboard.)

  2. Update email address in local config:

    $ git config --global user.email

  3. Reset the commit

    $ git reset --soft HEAD ~1

  4. Add, commit, and push your changes.

    $ git add .
    $ git commit -m "My commit message"
    $ git push
    

The commit should now succeed.

To learn more:

Vital statistics

  • First post: 12 May 2024
  • Source: Based, in part, on Stack Overflow question #43378060