问题
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
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?
回答1:
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.
来源:https://stackoverflow.com/questions/28850555/git-commands-on-gitlab-http-remote-fail-with-403