Email privacy error
How to resolve GH007 remote errors related to private email addresses.
2 minute read
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:
-
Use Github email settings to determine your noreply address. (Consider coping it to the Clipboard.)
-
Update email address in local config:
$ git config --global user.email
-
Reset the commit
$ git reset --soft HEAD ~1
-
Add, commit, and push your changes.
$ git add . $ git commit -m "My commit message" $ git push
The commit should now succeed.
To learn more:
-
Blocking command line pushes (GitHub, reviewed 12 May 2024)
-
Setting commit email address: (GitHub, reviewed 12 May 2024)
Vital statistics
- First post: 12 May 2024
- Source: Based, in part, on Stack Overflow question #43378060