Git Error with email set to private

So all I’m trying to do is the final step of publishing a repository. I’m working through the Front End Engineer course and on the video called Starting a Code Base on Git hub. I’ve done this a few times before on the course, with no issue.

Following the steps in this topic one of them was about setting your email private if you wanted to, which I have for now as it’s a work email. Now I’m in this video, Starting a Code Base on Git hub, and attempting to publish another repo it won’t allow the push command as it says it would publish a private email. GitHub says in this instance it will use their generated email, so I’m not sure what I did wrong here.

This is the command line message:

ProjectGit % git push -u origin main
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 223 bytes | 223.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
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: Sign in to GitHub · GitHub
To punkylilb/newProject · GitHub
! [remote rejected] main → main (push declined due to email privacy restrictions)
error: failed to push some refs to 'punkylilb/newProject · GitHub

I’m sure it’s something really obvious and since I don’t use Git that much yet I’m just missing it, so any help would be great :slightly_smiling_face:

You can either make your email address public on GH or follow that link provided to disable it. Or, you can configure Git to use your GH email address. Try:

git config --global "{ID}+{username}"


Ah ok, that was one of the steps before and I thought I had set it to the git email, I will double check that again, thanks.

1 Like

I’ve just done this to change my email, went to publish the repo and same issue :face_with_diagonal_mouth:

Found this solved it:
git commit --amend --author=“Author Name ” --no-edit

Thanks for pointing me in the right direction :+1:

For future reference, please don’t mark your own replies as a solution.