【问题标题】:git-update-server-info not sufficient to clone remote repo?git-update-server-info 不足以克隆远程仓库?
【发布时间】:2011-04-09 17:37:47
【问题描述】:

我想通过 Nginx HTTPS 服务器创建一个 git 存储库。

我已将提交后挂钩设置为运行 git-update-server-info 以更新“哑”后端的 refs。

通过 HTTPS 接口拉取更新工作正常,但是,当最初检查存储库时,它会失败:

[test@test ttt]$ git clone https://server/git/test.git/
Cloning into thesis...
Username: 
Password: 
error: The requested URL returned error: 401 (curl_result = 22, http_code = 401, sha1 = 2be2bcc15d1a79eb4e37e03fd2070ee0f229457c)
error: Unable to find 2be2bcc15d1a79eb4e37e03fd2070ee0f229457c under https://test/git/test.git
Cannot obtain needed commit 2be2bcc15d1a79eb4e37e03fd2070ee0f229457c
while processing commit 6c155f7098fd75f23edf71ac5b70b7c22f6070e7.
error: Fetch failed.

在服务器端存储库上手动运行“git update-server-info”并不能解决问题,但运行“git gc”可以。

但是,“git gc”修复仅在我将更新推送到服务器之前有效,之后整个“git clone”问题再次开始。

在服务器上我正在运行 git 1.7.1(来自 Debian 反向端口),在客户端上我正在运行 1.7.2.2(来自 Arch Linux)

关于如何解决这个问题的任何提示?不幸的是,目前无法选择运行“智能”HTTP 后端。

【问题讨论】:

    标签: git http clone


    【解决方案1】:

    有同样的错误,但在 URL 中包含用户名对我有用:

    https://myuser@server/git/test.git/
    

    【讨论】:

      【解决方案2】:

      我在这里遇到了同样的问题,这对我来说似乎是一个错误:虽然 git 要求输入用户名和密码,但它不会将其传递给服务器,因此服务器会正​​确响应 401(未授权)。

      到目前为止我发现的唯一解决方案:正确设置我的 netrc。简单地说

      machine <server>
      login <username>
      password <password>
      

      在你的 $HOME/.netrc 或 $HOME/_netrc for msysgit 中,验证将正常完成。

      【讨论】:

        【解决方案3】:

        【讨论】:

        • 是的,GitHub 已经关闭了它的支持论坛。如果您需要 GitHub 支持,请立即发送电子邮件至 support@github.com
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-04-27
        • 1970-01-01
        • 2019-08-03
        • 1970-01-01
        • 1970-01-01
        • 2015-06-12
        • 2014-02-26
        相关资源
        最近更新 更多