git commands on GitLab HTTP remote fail with 403
Asked Answered
E

2

9

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?

Ely answered 4/3, 2015 at 9:15 Comment(1)
In our Gitlab installation cloning over HTTP doesn't work either (only over SSH): engineer that configured Gitlab said, that this is known issue and probably fixed in more recent Gitlab.Simasimah
E
11

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.

Ely answered 4/3, 2015 at 9:31 Comment(3)
perfect answer. the same case persists for Gitlab on Ubuntu too. Recently I setup a global proxy, but on one machine restart I was facing this same error. What is seems like, on machine restart Gitlab instance was restarted, and then it could not resolve its clone path via proxy. Removed the proxy and did a full restart, now working fine!Macassar
I am currently having the similar issue where I can't git clone/pull/push remotely through a reverse proxy server, but can via local IP address bypassing it. (I haven't tested with SSH since it seems complicated to set up.) Could someone elaborate a bit more on how to fix it or mention what other possible solution there is?Slovak
Removing proxy line from .gitconfig solved this issuePerni
T
0

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"

Trantrance answered 6/6, 2021 at 12:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.