Error “Your push would publish a private email address”

后端 未结 5 1223
广开言路
广开言路 2020-12-04 04:56

I\'m very new to GitHub/VCS.

When I try to share my project on GitHub, I get the following error message.

    Can\'t finish GitHub sharing process
             


        
相关标签:
5条回答
  • 2020-12-04 05:43

    I had the same issue. My solution is in the picture below:

    GitHub Settings

    0 讨论(0)
  • 2020-12-04 05:46

    You have probably enabled (or it is enabled now by default) the email privacy feature of GitHub.

    It is detailed on this page at GitHub help.

    In short, there is a toggle that you can enable (which is enabled on your account) that prevents any push where the user is your actual email address. You can use an anonymized address instead (or choose to disable the feature).

    Details for both options are available at the same page.

    0 讨论(0)
  • 2020-12-04 05:50

    When enabling the “Block command line pushes that expose my email” feature, you’ll also want to configure Git to use your no-reply email address. Don’t worry—this won’t affect your contribution graph. All commits will still be associated with your account.

    1. Open Terminal.

    2. Change the current working directory to the local repository where you want to configure the email address that you associate with your Git commits.

    3. Find your GitHub noreply address in your GitHub's Personal Settings → Emails. It's mentioned in the description of the Keep my email address private checkbox. Usually, it starts with a unique identifier, plus your username.

    4. Set an email address in Git. Use your GitHub-provided no-reply email address.

      • Setting your email address for every repository on your computer

        git config --global user.email "{ID}+{username}@users.noreply.github.com"
        
      • Setting your email address for a single repository

        git config user.email "{ID}+{username}@users.noreply.github.com"
        
    5. Reset the author information on your last commit:

      git commit --amend --reset-author
      

      If you have multiple commits with your private e-mail address, see this answer.

    6. Now you can push the commit with the noreply e-mail address, and future commits will have the noreply e-mail address as well.

      git push
      

    Once you configure Git, commits will use your alternate “noreply” email address, and any pushes that don’t will be rejected.

    0 讨论(0)
  • 2020-12-04 05:50
    1. Go to Settings
    2. Click on Emails. Scroll to bottom. Keep my email addresses private section will be there.
    3. Note down public email id mentioned over there.
    4. Reset your local global email id with public email id mentioned in previous step using following command.
    $ git config — global user.email "<user_email_id>"
    
    1. Revert your last local commit which was getting blocked.
    $ git reset --soft HEAD~1 
    
    1. Make a fresh commit and push it. It will work.
    0 讨论(0)
  • 2020-12-04 05:56

    I experienced the same error: GH007 message as well and used the following to resolve the issue.

    1. Go to Setting your commit email address.
    2. Follow the Setting your email address for every repository on your computer.
    3. Open your GitHub account, and go to SettingsEmails.
    4. Select the Keep my email address private check box.
    5. Unselect the Block command line pushes that expose my email check box.

    This may expose your email address though.

    0 讨论(0)
提交回复
热议问题