4

I got error when commiting:

Your push would publish a private email address.

I see here it suggests set anonymous email address.

Your push would publish a private email address error

But I read documentation and it just shows to add in https://github.com/settings/emails

which requires verification. But I just set some random email [email protected] which I do not have. But the documentation says to verify it. I do not get it. Or do I need to create some real email or use some temporary email service just for this thing so I could verify?

I do not even understand why git push started to require some email at all. Few days ago I was pushing commits and there were no such error.

Update

Ok, this might be because I forked a repository and made a commit. I done a commit first time on forket repository. I cannot see where my email is actually visible in that commit.

1

3 Answers 3

5

After reading osowskit answer (thank you osowskit) I decided to try again what I tried unsuccessfully before, and this time it worked.

I guess I have to set it like this:

git config --global user.email "[email protected]" 

The email address is from the email settings page :

The email address is 6602631+darius-v@users.noreply.github.com

Maybe I did something wrong that day when I created this post. I was able to push.

2
  • 1
    You may have changed the commit you were trying to push. See my comment on the other answer. (And please mark the answer as accepted.) Commented Nov 8, 2019 at 5:21
  • Lot of time passed, I do not know which asnwer now I should accept, it will be ok as it is.
    – Dariux
    Commented Dec 1, 2020 at 18:17
2

But I just set some random email [email protected] which I do not have. But the documentation says to verify it. I do not get it.

GitHub will anonymize your existing email address when selecting to keep your email address private but requires you have a valid, verified email address. Note you will need to use the GitHub provided replyto email in your Git client.

From the docs

If you'd like to keep your personal email address private, you can use a GitHub-provided no-reply email address as your commit email address. To use your noreply email address for commits you push from the command line, use that email address when you set your commit email address in Git. To use your noreply address for web-based Git operations, set your commit email address on GitHub and choose to Keep my email address private.

3
  • "but requires you have a valid, verified email address" - so is it not enough that primary email is valid? I have checked "Keep my email address private" for primary (actually there is not option to check which email address I want to be private, so probably all of them are private). I do not get. If I have to add one more email, then what is the point of that? Do I have to set : git config --global user.email "[email protected]" - I found this address in description of checkbox "Keep ... private"
    – Dariux
    Commented Jan 16, 2018 at 11:49
  • Yes. GitHub provides that email adrdress for you to use.
    – osowskit
    Commented Jan 16, 2018 at 15:43
  • To highlight; you must use your GitHub-provided email address for the commit. If you've made the commit before setting the correct email address, fix the email address for the (last) commit with git commit --amend --author "YourName <[email protected]>". (see also stackoverflow.com/a/10365442/2662176 for the latest commit and stackoverflow.com/a/28845565/2662176 for a commit which is not the most recent.) Commented Nov 8, 2019 at 5:20
-1

I encountered the following problem and as a solution to it, I did the following and it was resolved.

if this feature "Keep my email addresses private" is on, you need to turn it off

remote: error: GH007: Your push would publish a private email address. remote: You can make your email public or disable this protection by visiting:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.