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
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
Go to settings -> emails and disable "Keep my email address private".
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 <9611418+ericraider33@users.noreply.github.com>"
And fill in with auto-generated email address that GitHub provides to each user.
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.
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 "XXXXXXXX+username@users.noreply.github.com" 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.
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.