【问题标题】:Gitlab public repo clone fails with "401 Unauthorized"Gitlab 公共回购克隆失败并显示“401 Unauthorized”
【发布时间】:2013-06-17 14:46:01
【问题描述】:

我希望有人可以帮助我诊断此问题。我正在使用最新的 ruby​​ 和 git 在默认的 Ubuntu 12.04 安装上运行 Gitlab 5.2。除了一些 LDAP 映射修改(用户名、显示名)之外,它主要是普通的。

我在使用 Gitlab 时遇到了一个我无法诊断的错误。每当我尝试克隆一个“公共”存储库时,而不是预期的(并且在 CentOS 上使用相同的 LDAP 映射修改):

Started GET "/dd/lol.git/info/refs?service=git-upload-pack" for 127.0.0.1 at 2013-06-17 10:21:55 -0400
Started POST "/dd/lol.git/git-upload-pack" for 127.0.0.1 at 2013-06-17 10:21:55 -0400

我得到(在 Ubuntu 上):

Started GET "/dd/lol.git/info/refs?service=git-upload-pack" for 127.0.0.1 at 2013-06-17 10:26:13 -0400
Started GET "/dd/lol.git/HEAD" for 127.0.0.1 at 2013-06-17 10:26:13 -0400
Started GET "/dd/lol.git/HEAD" for 127.0.0.1 at 2013-06-17 10:26:15 -0400
Started GET "/dd/lol.git/HEAD" for 127.0.0.1 at 2013-06-17 10:26:15 -0400
Started GET "/dd/lol.git/objects/8c/4e72acdc72843492f55d5918f53dd12e5f1e43" for 127.0.0.1 at 2013-06-17 10:26:15 -0400
Started GET "/dd/lol.git/objects/info/packs" for 127.0.0.1 at 2013-06-17 10:26:15 -0400

在客户端,我收到一致的“401 Unauthorized”消息,然后提示我输入密码。它似乎与 Apache 或 Nginx 代理无关。

客户端日志:

git clone http://127.0.0.1:9292/dd/lol.git
Cloning into 'lol'...
* Couldn't find host 127.0.0.1 in the .netrc file; using defaults
* About to connect() to 127.0.0.1 port 9292 (#0)
*   Trying 127.0.0.1...
* Adding handle: conn: 0x7fc610803000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fc610803000) send_pipe: 1, recv_pipe: 0
* Connected to 127.0.0.1 (127.0.0.1) port 9292 (#0)
> GET /dd/lol.git/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.7.12.4 (Apple Git-37)
Host: 127.0.0.1:9292
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

< HTTP/1.1 200 OK
< Content-Type: text/plain; charset=utf-8
< Last-Modified: Mon, 17 Jun 2013 14:33:31 GMT
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< X-UA-Compatible: IE=Edge,chrome=1
< X-Request-Id: 0a9ec65cffb7888fb6fbc136171fa80a
< X-Runtime: 0.079635
< Date: Mon, 17 Jun 2013 14:33:31 GMT
< X-Content-Digest: 198141e92e2cf9bb83d1aa1022fdea885993f02e
< Age: 0
< X-Rack-Cache: stale, invalid, store
< Content-Length: 59
< 
* Connection #0 to host 127.0.0.1 left intact
* Couldn't find host 127.0.0.1 in the .netrc file; using defaults
* Found bundle for host 127.0.0.1: 0x7fc6104155f0
* Re-using existing connection! (#0) with host 127.0.0.1
* Connected to 127.0.0.1 (127.0.0.1) port 9292 (#0)
* Adding handle: conn: 0x7fc610803000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fc610803000) send_pipe: 1, recv_pipe: 0
> GET /dd/lol.git/HEAD HTTP/1.1
User-Agent: git/1.7.12.4 (Apple Git-37)
Host: 127.0.0.1:9292
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

* The requested URL returned error: 401 Unauthorized
* Closing connection 0

非常欢迎任何建议,我对 Gitlab 不熟悉,目前有点难过。

  • 德米特里

【问题讨论】:

    标签: clone public repository gitlab


    【解决方案1】:

    激活 LDAP 的克隆似乎是一个反复出现的问题,尤其是通过 https:

    解决方法是proposed here,与文件lib/gitlab/backend/grack_auth.rb 相关,但最终修复仍在进行中。

    更新:从 5.3+ 和 6.x 开始,这应该已经修复了。

    【讨论】:

    • 感谢您提供信息丰富且简明扼要的回答。非常感谢。
    猜你喜欢
    • 2022-12-25
    • 2021-06-14
    • 1970-01-01
    • 2021-03-29
    • 1970-01-01
    • 2017-01-09
    • 1970-01-01
    • 2014-04-08
    • 2018-01-07
    相关资源
    最近更新 更多