http在gitlab中不起作用的git克隆

http在gitlab中不起作用的git克隆,git,apache,ubuntu,ssh,gitlab,Git,Apache,Ubuntu,Ssh,Gitlab,我在我的域(Ubuntu)中安装了GitLab CE,git克隆的http不起作用,但ssh运行良好 git克隆git@gitlab.mydomain.com:anshad/test.git有效 git克隆http://gitlab.mydomain.com/anshad/test.git不工作 Cloning into 'test'... Username for 'http://gitlab.mydomain.com': anshad Password for 'http://anshad@

我在我的域(Ubuntu)中安装了GitLab CE,git克隆的http不起作用,但ssh运行良好

git克隆git@gitlab.mydomain.com:anshad/test.git
有效

git克隆http://gitlab.mydomain.com/anshad/test.git
不工作

Cloning into 'test'...
Username for 'http://gitlab.mydomain.com': anshad
Password for 'http://anshad@gitlab.mydomain.com': 
fatal: unable to access 'http://gitlab.mydomain.com/anshad/test.git/': The requested URL returned error: 500
sudo-u git-H bundle exec rake gitlab:env:info RAILS\u env=production

System information
System:     Ubuntu 16.04
Current User:   git
Using RVM:  no
Ruby Version:   2.3.1p112
Gem Version:    2.5.1
Bundler Version:1.13.6
Rake Version:   10.5.0
Sidekiq Version:4.2.1

GitLab information
Version:    8.14.0-pre
Revision:   358e814
Directory:  /home/git/gitlab
DB Adapter: postgresql
URL:        http://gitlab.mydomain.com
HTTP Clone URL: http://gitlab.mydomain.com/some-group/some-project.git
SSH Clone URL:  git@gitlab.mydomain.com:some-group/some-project.git
Using LDAP: no
Using Omniauth: no

GitLab Shell
Version:    4.0.0
Repository storage paths:
- default:  /home/git/repositories/
Hooks:      /home/git/gitlab-shell/hooks/
Git:        /usr/bin/git
Checking GitLab Shell ...

GitLab Shell version >= 4.0.0 ? ... OK (4.0.0)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ... 
Anshad Vattapoyil / test ... repository is empty
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /home/git/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Reply by email ...

Reply by email is disabled in config/gitlab.yml

Checking Reply by email ... Finished

Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
projects have namespace: ... 
Anshad Vattapoyil / test ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.1)
Your git bin path is "/usr/bin/git"
Git version >= 2.7.3 ? ... yes (2.7.4)
Active users: 1

Checking GitLab ... Finished
sudo-u git-H bundle exec rake gitlab:check RAILS\u ENV=production

System information
System:     Ubuntu 16.04
Current User:   git
Using RVM:  no
Ruby Version:   2.3.1p112
Gem Version:    2.5.1
Bundler Version:1.13.6
Rake Version:   10.5.0
Sidekiq Version:4.2.1

GitLab information
Version:    8.14.0-pre
Revision:   358e814
Directory:  /home/git/gitlab
DB Adapter: postgresql
URL:        http://gitlab.mydomain.com
HTTP Clone URL: http://gitlab.mydomain.com/some-group/some-project.git
SSH Clone URL:  git@gitlab.mydomain.com:some-group/some-project.git
Using LDAP: no
Using Omniauth: no

GitLab Shell
Version:    4.0.0
Repository storage paths:
- default:  /home/git/repositories/
Hooks:      /home/git/gitlab-shell/hooks/
Git:        /usr/bin/git
Checking GitLab Shell ...

GitLab Shell version >= 4.0.0 ? ... OK (4.0.0)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ... 
Anshad Vattapoyil / test ... repository is empty
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /home/git/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Reply by email ...

Reply by email is disabled in config/gitlab.yml

Checking Reply by email ... Finished

Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
projects have namespace: ... 
Anshad Vattapoyil / test ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.1)
Your git bin path is "/usr/bin/git"
Git version >= 2.7.3 ? ... yes (2.7.4)
Active users: 1

Checking GitLab ... Finished
域的Apache虚拟主机配置

<VirtualHost *:80>
    ServerAdmin anshad@mydomain.com
    ServerName gitlab.mydomain.com
    ServerAlias www.gitlab.mydomain.com

    ServerSignature Off

    ProxyPreserveHost On

    AllowEncodedSlashes NoDecode

    <Location />
       Require all granted
       ProxyPassReverse http://localhost:8080
       ProxyPassReverse http://gitlab.mydomain.com/
    </Location>

    RewriteEngine on

    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
    RewriteCond %{REQUEST_URI} ^/uploads/.*
    RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA,NE]

    DocumentRoot /home/git/gitlab/public

    LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
    ErrorLog /var/log/apache2/gitlab_error.log
    CustomLog /var/log/apache2/gitlab_forwarded.log common_forwarded
    CustomLog /var/log/apache2/gitlab_access.log combined env=!dontlog
    CustomLog /var/log/apache2/gitlab.log combined
 </VirtualHost>
/home/git/gitlab/unicorn.rb
中,我有

worker_processes 4
working_directory "/home/git/gitlab" # available in 0.94.0+
listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 1024
listen "127.0.0.1:8080", :tcp_nopush => true
production.log
只说明了这一点

Started POST "/ci/api/v1/builds/register.json" for 35.154.26.24 at 2016-11-19 08:16:45 +0000
Started GET "/anshad/test.git/info/refs?service=git-upload-pack" for 137.97.204.60 at 2016-11-19 08:16:47 +0000
Processing by Projects::GitHttpController#info_refs as */*
  Parameters: {"service"=>"git-upload-pack", "namespace_id"=>"anshad", "project_id"=>"test.git"}
Filter chain halted as :authenticate_user rendered or redirected
Completed 401 Unauthorized in 23ms (Views: 0.3ms | ActiveRecord: 1.6ms)
Started POST "/ci/api/v1/builds/register.json" for 35.154.26.24 at 2016-11-19 08:16:48 +0000
Started POST "/ci/api/v1/builds/register.json" for 35.154.26.24 at 2016-11-19 08:16:51 +0000
Started POST "/ci/api/v1/builds/register.json" for 35.154.26.24 at 2016-11-19 08:16:54 +0000
Started GET "/anshad/test.git/info/refs?service=git-upload-pack" for 137.97.204.60 at 2016-11-19 08:16:56 +0000
Processing by Projects::GitHttpController#info_refs as */*
  Parameters: {"service"=>"git-upload-pack", "namespace_id"=>"anshad", "project_id"=>"test.git"}
Filter chain halted as :authenticate_user rendered or redirected
Completed 401 Unauthorized in 25ms (Views: 0.3ms | ActiveRecord: 2.2ms)
Started GET "/anshad/test.git/info/refs?service=git-upload-pack" for 137.97.204.60 at 2016-11-19 08:16:57 +0000
Processing by Projects::GitHttpController#info_refs as */*
  Parameters: {"service"=>"git-upload-pack", "namespace_id"=>"anshad", "project_id"=>"test.git"}
Completed 500 Internal Server Error in 98ms (ActiveRecord: 3.1ms)

JWT::DecodeError (Nil JSON web token):
  lib/gitlab/workhorse.rb:120:in `verify_api_request!'
  app/controllers/projects/git_http_client_controller.rb:154:in `verify_workhorse_api!'
  lib/gitlab/request_profiler/middleware.rb:15:in `call'
  lib/gitlab/middleware/go.rb:16:in `call'


Started POST "/ci/api/v1/builds/register.json" for 35.154.26.24 at 2016-11-19 08:16:57 +0000
首先,在GitLab上,仔细检查您的版本以及它是否与当前GitLab安装兼容

在您提到的所有GitLab问题中,对的评论似乎是最有希望的:

在我的例子中,workhorse的日志显示访问
/.gitlab\u workhorse\u secret

经过一些挖掘,修复方法是将以下内容添加到
/etc/systemd/system/gitlab workhorse.service中的workhorse启动命令行中:

作为参考,完整的
ExecStart
现在是:


另一种可能性是:

在我的例子中,500错误是由
/etc/gitlab/gitlab.rb
中的nginx配置错误引起的

如果我在nginx之前有什么,比如我的haproxy。我忽略了这个事实。如中所述

在我的例子中,haproxy将后端发送到8081,其中现在正在侦听nginx(最初我设置了8080-默认独角兽服务)-
我无法仅使用haproxy配置gitlab,而不使用nginx层

所以在我的配置中是很重要的

nginx['listen_port'] = 8081
nginx['listen_https'] = false
请注意,这两个问题都是针对NGiNX的(有)


还提到了403(权限被拒绝)错误:

我们能够通过启用HTTPS和SSH克隆来解决403问题;我们只启用了SSH克隆,这似乎是导致问题的原因。可以通过转到
https:///admin/application_settings
和双重检查
启用的Git访问协议


这些结论总结在下文中

但还有更多:

查看默认文件时,似乎对升级和默认设置有一些混淆。
使用默认配置文件示例(
init.d
nginx
),
gitlab workhorse
将侦听Unix套接字,而不是IP:端口。
Nginx示例配置文件确实有一些行用于Unix套接字,但代理传递到一个地址

我想第一次设置gitlab时,我需要将我的nginx配置指向Unicorn端口绑定,因为它是我启动gitlab服务时在netstat get setup中看到的唯一端口。
如果您向Unicorn发送
git clone
请求,您将收到500错误。
我要做的是改变gitlab workhorse,让它听我的回溯地址,并将Nginx指向那里。这就清除了我的HTTP 500克隆错误
了解更多关于


需要注意的是,所引用的这个系统是从源代码构建的,并且支持的nginx被Apache取代(gitlab不正式支持)。
这里是交易-在我的系统上的标准nginx配置中,我可以看到这一点

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

proxy_pass http://gitlab-workhorse;
这意味着-它正在使用套接字。不是网络端口。如果我试着看看这匹工作马是否在网络上收听,我会发现它不是

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

不会显示workhorse pid打开的任何网络端口。那么,也许apache配置不正确?它应该使用套接字而不是端口?

我无法理解此解决方案,无论如何,通过使用软件包卸载和安装它解决了问题。我的GitLab是使用源代码安装的,没有解决任何问题。现在从中卸载了所有内容并安装了GitLab软件包,即使在Apache中也可以正常工作。从软件包中删除了所有内容并安装了GitLab软件包,现在它在Apache中可以正常工作。我弄错了,我已经尝试了所有的可能性。正如您所提到的,Apache没有解决问题的方法,在GitLab提供一些配置之前,我应该使用nginx。
ps -ef|grep -i workhorse
lsof -p pid