GitLab HTTP 远程上的 git 命令失败并显示 403 [英] git commands on GitLab HTTP remote fail with 403

查看:105
本文介绍了GitLab HTTP 远程上的 git 命令失败并显示 403的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 GitLab 5.0 安装,突然无缘无故地开始在 HTTP URL 上执行 git 命令失败.git clone/pull/push 等任何命令都会失败,并出现以下错误:

I have a GitLab 5.0 installation that suddenly, for no apparent reason, started failing git commands on the HTTP URLs. Any command such as git clone/pull/push fails with the following error:

fatal: unable to access 'http://host/user/project.git/': The requested URL returned error: 403

错误发生在任何提示用户/密码之前.这发生在现有项目和新项目中.SSH URL 继续正常工作.HTTP 上的 GitLab UI 也可以正常工作.

The error happens before any prompt for user/password. This happens for existing and new projects. The SSH URLs continue to work just fine. The GitLab UI on HTTP works fine too.

知道可能出了什么问题或如何排除故障吗?

Any idea what might be wrong or how to troubleshoot it?

推荐答案

通常情况下,我在发布后不久就发现了问题所在.线索是 HTTP 在主机上本地工作.原来我在我尝试过的所有 Windows 机器上都配置了 HTTP_PROXY 变​​量(我最近需要它用于 cabal ,它没有检测到 Windows 上的代理自动设置).看起来 git 是通过代理连接到 GitLab 端点导致错误.我去了 C:Users{User} 并删除了文件 .gitconfig 中与 Proxy 相关的行.留下答案以防对其他人有帮助.

As is often the case I found what the problem was shortly after posting. The clue was that HTTP worked locally on the hosting machine. Turns out I had HTTP_PROXY variable configured on all Windows boxes I tried (I needed it recently for cabal which doesn't detect proxy automatic setting on Windows). Looks like git was connecting to GitLab endpoint via proxy leading to the error. I went to C:Users{User} and removed the line related to Proxy in the file .gitconfig. Leaving the answer in case it helps someone else.

这篇关于GitLab HTTP 远程上的 git 命令失败并显示 403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆