Git push时出现错误 GH007: Your push would publish a private email address.


今天在使用 github 时遇到了个问题,如下:

$ git push origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 362 bytes | 72.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:xiaomaoyun/test.git
 ! [remote rejected] master -> master (push declined due to email privacy restrictions)
error: failed to push some refs to 'git@github.com:xiaomaoyun/test.git'

其实,从里面的错误提示就可以看出哪里出了问题。大概的意思就是:你需要禁用邮箱保护才可以 push。
(这才想起来我用了一个新的帐号。)
于是打开 settings,找到 Email 选项:
Git push时出现错误 GH007: Your push would publish a private email address.
看到上图画红框的文字:
Block command line pushes that expose my email。
If you push commits that use a private email as your author email we will block the push and warn you about exposing your private email。
不要勾选此项,就可以正常的 push 了。


<< Git 命令总结与声明


没有账号? 忘记密码?

社交账号快速登录