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

查看:155
本文介绍了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天全站免登陆