3

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 noreply@yahoo.com 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.

Dariux
  • 3,953
  • 9
  • 43
  • 69
  • Does this answer your question? [Meaning of the GitHub message: push declined due to email privacy restrictions](https://stackoverflow.com/questions/43378060/meaning-of-the-github-message-push-declined-due-to-email-privacy-restrictions) – Henke Apr 14 '22 at 13:24

3 Answers3

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 "6602631+darius-v@users.noreply.github.com" 

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.

Henke
  • 4,445
  • 3
  • 31
  • 44
Dariux
  • 3,953
  • 9
  • 43
  • 69
  • 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.) – user3.1415927 Nov 08 '19 at 05:21
  • Lot of time passed, I do not know which asnwer now I should accept, it will be ok as it is. – Dariux Dec 01 '20 at 18:17
2

But I just set some random email noreply@yahoo.com 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.

osowskit
  • 5,904
  • 2
  • 29
  • 38
  • "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 "6602631+darius-v@users.noreply.github.com" - I found this address in description of checkbox "Keep ... private" – Dariux Jan 16 '18 at 11:49
  • Yes. GitHub provides that email adrdress for you to use. – osowskit Jan 16 '18 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 "`. (see also https://stackoverflow.com/a/10365442/2662176 for the latest commit and https://stackoverflow.com/a/28845565/2662176 for a commit which is not the most recent.) – user3.1415927 Nov 08 '19 at 05: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

Onur Dikmen
  • 339
  • 1
  • 6
  • 17