企业代理环境下无法Push到GitHub:提示无匿名写入权限
企业局域网下GitHub Push认证失败求助
我已研究过相关解决方案但均无效,包括以下方法:
- VS Code推送到GitHub时出现"fatal: Authentication failed for"错误的解决办法
- Git与GitHub认证失败提示"remote: No anonymous write access"的解决办法
背景
在需通过HTTP代理访问外部网络的企业局域网中,我尝试访问并Push到自己的GitHub仓库。已通过IntelliJ以HTTP模式拉取仓库,但无法Push,始终报错:
remote: No anonymous write access.
fatal: Authentication failed for 'https://github.com/...'
已尝试方案
- 使用IntelliJ的“登录到GitHub”功能:授权成功但Push失败
- 在IntelliJ提示时使用PAT(经典和细粒度两种)
- 修改远程git URL,包含用户和PAT认证信息
- 通过Shell而非IntelliJ进行Push
- 使用GitHub Desktop推送
以上方法均无效。
补充背景
- 未配置git凭据助手
- 因企业限制无法使用SSH
- 操作系统为Windows 10
- IntelliJ中代理设置正确(测试github.com可连通)
- 用任意无效字符串替代PAT,结果完全相同
我开始怀疑代理拦截或篡改了认证信息,导致无法正常验证。
2024-04-24 更新
我开启了git追踪,日志显示git使用basic认证,无论输入密码、PAT还是无效字符串,结果均一致。同时用curl测试也得到相同结果:
$ curl -vvv -k --request GET --url "https://github.com/ogerardin/project-guarana.git/info/refs?service=git-receive-pack" --header "Accept: application/vnd.github+json" --user ogerardin
使用bearer认证和令牌测试同样失败:
$ curl -vvv -k --request GET --url "https://github.com/ogerardin/project-guarana.git/info/refs?service=git-receive-pack" --header "Accept: application/vnd.github+json" --header "Authentication: bearer ***************************"
请问还有其他可尝试的解决方案吗?
内容的提问来源于stack exchange,提问作者Olivier Gérardin
相关产品推荐
相关产品推荐

