【踩坑】Git推送到Github时报错
前言
Git推送到Github时报错:push declined due to email privacy restrictions
原因
- Github账户开启了
Keep my email addresses private
和Block command line pushes that expose my email
来保护隐私后,推送到Github时,如果提交代码的邮箱是登录账户邮箱,会被拒绝提交
解决问题
- 关闭
Block command line pushes that expose my email
隐私保护,或者Undo Commit后,修改提交代码的邮箱(改为Github转发邮箱),再重新提交,然后推送
<id><username>@users.noreply.github.com
:Github转发邮箱
1 | git config --global user.email <id><username>@users.noreply.github.com |