【Git】解决remote: error: GH007: Your push would publish a private email address.

本文介绍了在使用Git命令行推送代码到Gitee时遇到由于邮箱隐私设置不允许公开而引发的错误。通过分析错误信息,发现是因为Gitee的邮箱保护设置导致的。解决方案是进入Gitee仓库设置,取消不公开邮箱地址的选项。按照此方法调整后,成功推送代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题描述:

用git命令行提交gitee上的代码:

git push -u origin master:master

Bash终端上显示如下:

$ git push -u origin master
Enumerating objects: 13, done.
Counting objects: 100% (13/13), done.
Delta compression using up to 8 threads
Compressing objects: 100% (13/13), done.
Writing objects: 100% (13/13), 4.37 KiB | 4.37 MiB/s, done.
Total 13 (delta 7), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.2]
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
To https://gitee.com/xxx/test.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'https://gitee.com/xxx/test.git'

原因分析:

因为在Gitee里设置了不公开邮箱地址,同时禁止了命令行推送暴露个人邮箱,所以导致新项目在push的时候出错:remote: error: GH007: Your push would publish a private email address.

解决方案:

进入Gitee仓库–设置–邮箱管理,去除掉不公开我的邮箱地址。
在这里插入图片描述
重新提交命令即可

git push -u origin master:master

成功后显示如下代码

Enumerating objects: 13, done.
Counting objects: 100% (13/13), done.
Delta compression using up to 8 threads
Compressing objects: 100% (13/13), done.
Writing objects: 100% (13/13), 4.37 KiB | 4.37 MiB/s, done.
Total 13 (delta 7), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.2]
To https://gitee.com/xxx/test.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DomCode

你的鼓励将是我创作的最大动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值