git clone with http not working in gitlab

送分小仙女□ 提交于 2019-12-07 02:14:26

It's important to note that this system referenced in question was built from source code and supported nginx was replaced with Apache (not officially supported by gitlab).
Here is the deal - in the standard nginx config on my system I can see this

upstream gitlab-workhorse {
  server unix:/var/opt/gitlab/gitlab-workhorse/socket;
}

proxy_pass http://gitlab-workhorse;

Which means - it's using socket. Not a network port. If I try to see if the workhorse even listening on network - I will see that it's not.

ps -ef|grep -i workhorse
lsof -p pid

Would not show any network ports open by workhorse pid. So perhaps apache config is incorrect? It should be using socket instead of port?

First, double-check your gitlab workhorse version and if it is compatible with your current GitLab installation.

Of all the GitLab issues you reference, the comments on 22484 seem the most promising:

In my case, workhorse's logs showed an error accessing ./.gitlab_workhorse_secret

After some digging, the fix was to add the following to the workhorse startup command line in /etc/systemd/system/gitlab-workhorse.service:

-secretPath /home/git/gitlab/.gitlab_workhorse_secret 

For reference, the full ExecStart is now:

ExecStart=/home/git/gitlab/bin/daemon_with_pidfile /home/git/gitlab/tmp/pids/gitlab-workhorse.pid \
/home/git/gitlab-workhorse/gitlab-workhorse -listenUmask 0 -listenNetwork unix \
-listenAddr /home/git/gitlab/tmp/sockets/gitlab-workhorse.socket \
-authBackend http://127.0.0.1:8080 -authSocket /home/git/gitlab/tmp/sockets/gitlab.socket \
-documentRoot /home/git/gitlab/public -secretPath /home/git/gitlab/.gitlab_workhorse_secret \
>> /home/git/gitlab/log/gitlab-workhorse.log 2>&1

The other possibility is:

In my case 500 error was caused by bad nginx configuration in /etc/gitlab/gitlab.rb.

In case where I had something "before" the nginx, like in my case haproxy. I overlooked this fact. It is described in NGiNX settings.

In my case in haproxy sends backend to 8081 where is listening nginx now (originally I setted 8080 - default unicorn service) -
I was not able configure gitlab only with haproxy, without nginx layer.

So in my configuration was important

nginx['listen_port'] = 8081
nginx['listen_https'] = false

Note that both issues are for NGiNX (there is one when Apache2 is used)


There is also a mention about 403 (permission denied) errors:

We were able to resolve the 403 issue by enabling both HTTPS and SSH cloning; we only had SSH cloning enabled which seemed to be causing the problem. This can be changed by going to https:///admin/application_settings and double checking Enabled Git access protocols


Those conclusions are summarized in merge request 6843

But there is more:

Looking at the default files, it looks like there is some sort of confusion with upgrades and what the defaults should be.
With the default configuration file examples (init.d and nginx), gitlab-workhorse will listen on a Unix socket and not an IP:port.
The Nginx example config file does have some lines for Unix sockets, but the proxy pass goes to an address.

I thought setting gitlab up for the first time I needed point my nginx config to the Unicorn port bind as it was the only port I was seeing in netstat get setup when I started the gitlab services.
If you send the git clone request to Unicorn you will get the 500 error.
What I had to do is change gitlab-workhorse to listen to my lookback address and point Nginx there. That cleared up my HTTP 500 error with cloning.
See more with A Brief History of GitLab Workhorse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!