Skip to content

Instantly share code, notes, and snippets.

@gengwg
Created October 10, 2019 03:44
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save gengwg/ef9a073a6fd845786d5993914439c946 to your computer and use it in GitHub Desktop.
Save gengwg/ef9a073a6fd845786d5993914439c946 to your computer and use it in GitHub Desktop.
remote: error: GH007: Your push would publish a private email address.
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 681 bytes | 681.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 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: http://github.com/settings/emails
To github.com:gengwg/xxxxx.git
 ! [remote rejected] master -> master (push declined due to email privacy restrictions)
error: failed to push some refs to 'git@github.com:gengwg/xxxxx.git'

The steps I took to fix (thanks for the advice on this thread) were roughly as follows:

git config --global user.email "526473+gb96@users.noreply.github.com"
git rebase -i
git commit --amend --reset-author
git rebase --continue
git push

I found rebase -i allowed be to edit the commit message but retained the previous (private) email address in the log.

The commit --amend --reset-author seemed to be the easiest way to replace the offending email address.

@alonchis
Copy link

alonchis commented Oct 9, 2020

nice, can confirm this fixes GH007 error. thanks!

@dmvianna
Copy link

I found that ammending is enough -- no need to rebase.

@TheGnomeDev
Copy link

Thank you, it was my first commit to this repo so nothing to rebase, but it did let me make that amend. Why Sourcetree doesn't have this built-in is beyond me.

@OperationalFallacy
Copy link

Thanks!

@SergeyVashkevich
Copy link

Спасибо !

@simonwyse
Copy link

Just what I needed, thank you!

@MrWaithira
Copy link

I agree with dmvianna after git commit --ammend --reset-author there is no need to rebase. I went ahead and pushed it worked. Thanks for this solution.

@gulina002
Copy link

thank you! I have spend 2 hours for this

@RudeCoffee
Copy link

Still works! Thank you

@herman-the-worm
Copy link

Thanks

@shellheim
Copy link

Thanks man you probably saved me a tonne of time!

@ksb96
Copy link

ksb96 commented Jun 12, 2023

I m getting an error while executing this git statement - git commit --amend --reset-author
Showing unable to update on the database.

@acetousk
Copy link

acetousk commented Aug 5, 2023

This is great! Thank you

@omarzam-dev
Copy link

Me amaneci rompiendome la cabeza, me soluciono el problema. Gracias

@atc2146
Copy link

atc2146 commented Dec 25, 2023

Thank you!

@rbrisita
Copy link

NOTICE

Please change the user.email to the one assigned to you by GitHub. It is found at https://github.com/settings/emails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment