Error while setting up Git with Github

Hi folks,
I am working on the following exercise:

trying to set up my first remote repository and when I run the command on my terminal, I get the following error message:

Remote: error : GH007: Your push would publish a private email address.
remote: You can make your email public or disable this protection by visiting:
remote: github url
To github url
! [remote rejected] main → main (push declined due to email privacy restrictions)
error: failed to push some refs to ‘github url’

Thank you in advance for your help.


Hello, and welcome to the forums!

It seems that you turned on these options in GitHub:

but when you configured the email address for git to use locally, you probably used the email address associated with GitHub rather than the one they generated for you to use for privacy. You should use the email address from the spot I blurred out in the previous screenshot. It will be personalized for you in the GitHub settings under Emails.

You can reconfigure it using:

git config --global ""

That will solve the issues for new git repositories you create locally from now on.

However, it won’t retroactively fix the ones you already created.

  • If you’ve only created a test repository, this won’t be a problem because you can start over.
  • If you have a long history of git commits that you want to keep, then the solutions to change the author information of previous commits can be quite involved and dangerous. Here’s an article that discusses some options to do that if you want: Editing the Author of Past Commits

Alternatively, you could uncheck the “Block command line pushes that expose my email” in GitHub’s settings.