When I am trying to push my commits with GitHub Desktop it showing this error "Cannot push these commits as they contain an email address marked as private on GitHub"
Please help me how to fix this error
Head to the Settings section of GitHub, and then select the Emails menu item. In here, you'll find a checkbox labeled 'Keep my email addresses private'. Within the description for this label, you'll find your GitHub noreply address.
If you'd like to keep your personal email address private, you can use a noreply email address from GitHub 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.
Setting your commit email address on GitHub In the upper-right corner of any page, click your profile photo, then click Settings. In the left sidebar, click Emails. In the "Primary email address" list, select the email address you'd like to associate with your web-based Git operations.
Git CLI setup: You could use any email address. But, you must have used an email address that is connected with your GitHub account. The email address linked with Github ensures that commits are attributed to you and appear in your contributions graph.
The other answers are fine for future commits, but don't help for prior commits that contain a public email address. If you want to keep your email private, then you should modify the prior commits instead of changing your settings. Use git cmd, like:
git commit --amend --author="ericraider33 <[email protected]>"
And fill in with auto-generated email address that GitHub provides to each user.
If you still don't want to expose your email address:
Go to https://github.com/settings/emails and save your "noreply address".
Set your git email address to this noreply address, either with the command git config --global user.email "[email protected]"
or inside GitHub Desktop's preferences.
Save somewhere the changes that you want to push.
Revert changes in your last commits, as they were signed with the previously configured email address.
Restore the changes that you saved.
Commit.
Push.
Go to settings -> emails and disable "Keep my email address private".
I ran into this problem too. It is an easy fix in Github Desktop by going to File -> Options -> Git and clear the Username and Email fields and save it. Then if you are logged in to GitHub it will fill them in with correct information.
You're likely pushing a commit that is signed using your email address, and in your settings on Github. You can change this behavior by either going to GitHub (browser) clicking on the user icon on the top right corner -> Settings -> Emails and unchecking the box that says "Block command line pushes that expose my email", make your email not private (right above that option), or sign your commits with a public email.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With