Enumerating objects: 19, done.
Counting objects: 100% (19/19), done.
Delta compression using up to 22 threads
Compressing objects: 100% (18/18), done.
Writing objects: 100% (18/18), 10.41 MiB | 4.59 MiB/s, done.
Total 18 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 1 local object.
remote: error: GH007: Your push would publish a private email address.
remote: You can make your email public or disable this protection by visiting:
remote: https://github.com/settings/emails
To github.com:gengwg/myrepo.git
! [remote rejected] master -> master (push declined due to email privacy restrictions)
error: failed to push some refs to 'github.com:gengwg/myrepo.git'
Your commit worked locally, but GitHub rejected the push because of its email privacy protection.
The key error is:
GH007: Your push would publish a private email address.
GitHub blocks pushes when:
- Your commit email is not the GitHub-provided noreply email
- AND you have “Keep my email address private” enabled
You configured Git as:
git config --global user.email "gengwg@xyz.com"But in your GitHub account:
- Your email is probably set to private
- GitHub expects you to use a special noreply email
- Go to: 👉 https://github.com/settings/emails
- Find your noreply email, it looks like:
12345678+gengwg@users.noreply.github.com
Copy it.
Run:
git config --global user.email "12345678+gengwg@users.noreply.github.com"(Replace with your actual noreply email.)
Since the commit was already created with the wrong email, amend it:
git commit --amend --reset-authorThen push again:
git pushYou could instead:
- Go to GitHub email settings
- Uncheck "Keep my email address private"
Then your gengwg@xyz.com will work.
But most developers prefer using the noreply email.
Using the noreply email:
- Protects your personal email
- Prevents spam
- Keeps Git history clean
- Still links commits to your GitHub account
Best fix:
git config --global user.email "YOUR_NOREPLY_EMAIL"
git commit --amend --reset-author
git push