如何避免Git提交时出现错误:防止因推送包含私人邮箱地址而引发的GE007问题
最编程
2024-02-08 20:26:08
...
错误情况: gitte提交报错,无法提交上去,报错如下:
remote: Powered by GITEE.COM [GNK-6.0]
remote: error: GE007: Your push would publish a private email address.
remote: You can make your email public or disable this protection by visiting:
remote: https://gitee.com/profile/emails
remote: error: hook declined to update refs/heads/master
error: failed to push some refs to 'https://gitee.com/ck_567/leet-code-practice.git'
To https://gitee.com/ck_567/leet-code-practice.git
! refs/heads/master:refs/heads/master [remote rejected] (hook declined)
Done
原因:因为在gitee里设置了不公开邮箱地址,同时禁止了命令行推送暴露个人邮箱
解决:需要设置gitte上找到允许推送的邮箱地址,然后设置在本地的git环境变量中。
- 在gitte设置中找到邮箱管理,如下:
- 将提交邮箱设置这里的邮箱拿出来设置到你本地,如下:
# 设置你的提交邮箱
git config --global user.email 3784276328_wsnbb@user.noreply.gitee.com
# 查看全部变量
git config -l