Skip to content

Instantly share code, notes, and snippets.

@davidogbiko
Forked from gengwg/github_private_email.md
Created March 14, 2020 19:39
Show Gist options
  • Select an option

  • Save davidogbiko/ab54e54b580afbe55bead1a0b2b0f6d2 to your computer and use it in GitHub Desktop.

Select an option

Save davidogbiko/ab54e54b580afbe55bead1a0b2b0f6d2 to your computer and use it in GitHub Desktop.

Revisions

  1. @gengwg gengwg created this gist Oct 10, 2019.
    28 changes: 28 additions & 0 deletions github_private_email.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    ```$ git push -u origin master
    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 '[email protected]: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 "[email protected]"
    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.