Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 246
kruipen Avatar asked Mar 04 '15 09:03

kruipen


People also ask

How do I fix the requested URL returned error 403 in Git repository?

There are a few possible causes for this problem: You typed an incorrect password. Make sure you are using the correct GitHub password for the account. The Git client on the A2 Hosting server requires a modified HTTPS URL to work correctly.

How do I fix 403 error on GitHub?

The first is relatively simple to resolve and simply involves checking to ensure your GitHub password is correct. If the error persists, it is likely that you have to use a different HTTPS address in your Git client. For this error, you will not even be prompted to enter a password, making it simpler to diagnose.

Can I use Git bash for GitLab?

To get started, you'll need to install and configure Git on your system and create an account on GitLab and install GitBash for windows. Note: Before pushing the code into Gitlab, you need to make sure that all the files must be placed into one folder.


1 Answers

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.

like image 66
kruipen Avatar answered Oct 20 '22 13:10

kruipen