Meaning of the GitHub message: push declined due to email privacy restrictions

前端 未结 6 442
终归单人心
终归单人心 2021-01-29 16:56

I have accepted and merged a pull request on GitHub, and now I cannot pull my commits any more.

The message is:

! [remote rejected] master -> master (pu         


        
相关标签:
6条回答
  • 2021-01-29 17:33

    Uncheck Block command line pushes that expose my email and then try pushing the code from command line.

    0 讨论(0)
  • 2021-01-29 17:35

    This is likely caused by a new GitHub setting that blocks command line pushes that expose your email address.

    Try unchecking the "Block command line pushes that expose my email" box in your email settings and then pushing again.

    0 讨论(0)
  • 2021-01-29 17:38

    The remote repository has been configured to disallow you pushing a commit that would reveal your personal e-mail address. For example in GitHub you have checked the Block command line pushes that expose my email checkbox to enable this.

    While you can of course uncheck that setting, it will expose your private e-mail address to everyone in the world, as author information is readable by anyone with access to your repository.

    Instead, do this:

    1. You can see your personal e-mail address, which is used by default for your commits in Git:

      git config --global user.email
      
    2. 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:

      {ID}+{username}@users.noreply.github.com
      

    3. Change the global user e-mail address setting to be your GitHub noreply address:

      git config --global user.email {ID}+{username}@users.noreply.github.com
      
    4. 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.

    5. 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
      
    0 讨论(0)
  • 2021-01-29 17:40

    Using Github Desktop fixed my issue.

    0 讨论(0)
  • 2021-01-29 17:52

    I solved the errors by:

    git config --global user.email ""

    This just sets my email to blank (an empty string). I now set my email in individual projects with:

    git config user.email "myemail@domain.com"

    0 讨论(0)
  • 2021-01-29 17:56
    1. Just go to github.com and click on your profile
    2. Go to settings
    3. Now click on the 'Email' on the left navigation panel
    4. And search for the field 'Keep my email addresses private'
    5. Please uncheck this option
    6. Now please check again and I think your problem is solved now.
    0 讨论(0)
提交回复
热议问题