Your push would publish a private email address error


Your push would publish a private email address error



I'm very new to Github/VCS.



When I try to share my project on Github, I get the following error message.


Can't finish GitHub sharing process
Successfully created project 'myproject' on GitHub, but initial push failed:
remote: error: GH007: Your push would publish a private email address.
failed to push some refs to 'https://github.com/me/myproject.git'



I've googled the error message, and got no hits. I've also searched stackexchange, but no cigar. Any ideas on how to solve this issue?





I removed references to pycharm as the error has to do with github and not pycharm.
– Burhan Khalid
May 9 '17 at 7:26




4 Answers
4



I experienced the same error: GH007 message as well, and used the following to resolve the issue.


error: GH007





This is a solution but might actually expose your email address. If you have any commits that haven't been pushed yet, you'll need to uncheck Block command line pushes that expose my email. Then you can push those pending commits. Afterwards, update your email address to the no-reply email address and check Block command line pushes that expose my email again to keep your address private.
– SvenAelterman
Jul 20 '17 at 18:54






@SvenAelterman update your email address to the no-reply email address where? In the github settings or on your local machine somewhere that's presumably sending/using your private email address? It strikes me as counterintuitive that I might be supposed to copy and past an email address generated by github directly back into github rather just click on a checkbox, therefore I assume that reading is incorrect. Or is it??
– hippietrail
Oct 11 '17 at 6:48



update your email address to the no-reply email address





@hippietrail git help tells you to copy the no reply email to your git config --global setting on the client. it will be blocked as private first use too, but unblock for the first push, then block subsequent pushes. you only need to unblock if you change the email address and need to push it to the public repo
– CharlieS
Mar 3 at 6:53





To change the email for your latest commit use git commit --amend --author="Author Name <email@address.com>"
– dspacejs
Apr 28 at 7:29


git commit --amend --author="Author Name <email@address.com>"



You have probably enabled (or it is enabled now by default) the email privacy feature of github.



It is detailed on this page at github help.



In short, there is a toggle that you can enable (which is enabled on your account) that prevents any push where the user is your actual email address. You can use an anonymized address instead (or choose to disable the feature).



Details for both options are available at the same page.





Thanks! I anonymized my email adres and that solved the issue!
– user156060
May 9 '17 at 8:06





Using the anonymized email address is a good solution. If you created it prior to July 18, 2017, you may want to do it again to get 7 random digits added to it.
– SvenAelterman
Jul 20 '17 at 18:50



When enabling the "Block command line pushes that expose my email" feature, you’ll also want to configure Git to use your no-reply email address. Don’t worry—this won’t affect your contribution graph. All commits will still be associated with your account.



Once you configure Git, commits will use your alternate “noreply” email address, and any pushes that don’t will be rejected.



Setting your email address for every repository on your computer



Find your GitHub noreply address in your GitHub's Personal Settings → Emails. It's mentioned in the description of the Keep my email address private checkbox. Usually, it starts with a unique identifier, plus your username.



Set an email address in Git. Use your GitHub-provided no-reply email address.


git config --global user.email "{ID}+{username}@users.noreply.github.com"`



Reset the author information on your last commit:


git commit --amend --reset-author



If you have multiple commits with your private e-mail address, see this answer.



Now you can push the commit with the noreply e-mail address, and future commits will have the noreply e-mail address as well.


git push



Setting your email address for a single repository



Open Terminal.



Change the current working directory to the local repository where you want to configure the email address that you associate with your Git commits.



Find your GitHub noreply address in your GitHub's Personal Settings → Emails. It's mentioned in the description of the Keep my email address private checkbox. Usually, it starts with a unique identifier, plus your username.



Set an email address in Git. You can use your GitHub-provided no-reply email address.


git config user.email "{ID}+{username}@users.noreply.github.com"



Reset the author information on your last commit:


git commit --amend --reset-author



If you have multiple commits with your private e-mail address, see this answer.



Now you can push the commit with the noreply e-mail address, and future commits will have the noreply e-mail address as well.


git push



Further reading: GitHub Help



I had the same issue. My solution is in the picture below:



GitHub Settings






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

how to run turtle graphics in Colaboratory

Export result set on Dbeaver to CSV