Error clone project gitlab with https

2020-07-10 06:26发布

问题:

I've a problem when i try to clone my Gitlab project with the protocol "Https". With the git protocol everything works fine.

The error:

Cloning into 'test'...
fatal: https://XXXX.XXXX.XXXX.XXXX/user.name/test.git/info/refs?service=git-upload-pack
not found: did you run git update-server-info on the server?

I've tried many solutions but the error is still here.

Somebody can help me?

Thank's for your help and have a nice day!

回答1:

My Problem was the Apache configuration file. My example configuration

<VirtualHost ip:80>
  ServerName git.domain.tld
  Redirect permanent / https://git.domain.tld/
</VirtualHost>

<VirtualHost ip:443>
  ServerName git.domain.tld
  DocumentRoot /home/git/gitlab/public

  <Location />
    ProxyPassReverse http://127.0.0.1:8080
    ProxyPassReverse http://git.domain.tld
  </Location>

  RewriteEngine on
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA]
  RequestHeader set X_FORWARDED_PROTO 'https'
</VirtualHost>

Source: https://github.com/gitlabhq/gitlab-recipes/tree/master/web-server/apache



回答2:

A common source of this error is some sort of mistake in the URL. Be sure you have it right. Can you clone over HTTP? Is your server set up to serve the repository over both HTTP and HTTPS?

If your git client (read the output of git --version), it won’t be able to use the smart HTTP back end.

A comment in GitLab issue #1924 suggests ruling out permission issues on the server side.



回答3:

This error can occur when you've changed the default configuration for the relative_url_root variable for the gitlab application in your .../gitlab/config/gitlab.yml config file. The default value is /. When you change the default value to, e.g. /gitlab, the url will be

    http://your.domain/gitlab

This is showed as the cloning url for a project in the UI correctly, e.g.

    http://your.domain/gitlab/group/project.git

but somehow this configuration is not checked, while doing the actual clone over http or https.

There has already been a discussion and a bugfix about it in the gitlab issue list on github. Here is the rawfile.

My configuration is gitlab v5.0 and gitlab-shell v1.1.0.



标签: git https gitlab