Although I've set my `git --global user.email` to the `no-reply` email adress which I fund in my github email preferences, I still get this error:
$ git push origin readme-dev
Counting objects: 8, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 984 bytes | 984.00 KiB/s, done.
Total 8 (delta 6), reused 0 (delta 0)
remote: Resolving deltas: 100% (6/6), completed with 5 local objects.
remote: error: GH007: Your push would publish a private email address. [...] ! [remote rejected] readme-dev -> readme-dev (push declined due to email privacy restrictions)
Solved! Solved! Go to Solution.
If you run
git config --local --list does it display a different email than you have in your global Git config?
It didn't show any email. I also tried to add a local email which than showed up in the `git config --local --list`. Still got the same error.
However, when I try to push my local master branch to the remote master branch it seems to work, only my newly created local development branch will not push with `git push origin dev`
file:/home/user/.gitconfig user.name Troyciv file:/home/user/.gitconfig user.email 14926781+Troyciv@users.noreply.github.com file:.git/config user.email 14926781+Troyciv@users.noreply.github.com
@Troyciv it looks like everything is configured correctly now but it is possible that you have some commits on that other branch that were written with some other values. You should be able to use the command `git log --first-parent --no-merges` when on the other branch to take a look at the commit information to find which commits have non-private email information. Then you can use `git rebase -i` to rewrite those commits so they have the new private email information.
I just encounterd the same problem.
The steps I took to fix (thanks for the advice on this thread) were roughly as follows:
git config --global user.email "email@example.com" git rebase -i git commit --amend --reset-author git rebase --continue git push
I found rebase -i allowed be to edit the commit message but retained the previous (private) email address in the log.
The commit --amend --reset-author seemed to be the easiest way to replace the offending email address.
I'm not at all sure what happened, but this ended up costing me a day's work. I followed the directions exactly, and ended up losing a commit that hadn't yet been pushed.
Just need to remove one checkbox as described here:
This is likely caused by a new GitHub setting that blocks command line pushes that expose your email address.
Try unchecking the "Block command line pushes that expose my email" box in your email settingsand then pushing again.