kruipen
kruipen

Reputation: 299

git commands on GitLab HTTP remote fail with 403

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?

Upvotes: 9

Views: 11749

Answers (2)

Guna Sekaran
Guna Sekaran

Reputation: 563

Error : Fatal: unable to access : Received HTTP code 403 from proxy after CONNECT

Solution You can configure the below proxy globally in your user ~/.gitconfig file, Copy lines to GitBash one by one,

git config --global --add http.proxy http://example.com:83

git config --global --add https.proxy http://example.com:83

git config --global --add no.proxy "localhost, 127.0.0.1, .example.com"

Upvotes: 0

kruipen
kruipen

Reputation: 299

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.

Upvotes: 11

Related Questions