【问题标题】:Git clone fails with GnuTLS errorGit 克隆因 GnuTLS 错误而失败
【发布时间】:2016-05-05 10:14:05
【问题描述】:

我尝试在 ubuntu 16.04 上通过 git clone https://github.com/git/git.git 克隆 github 上的 git 存储库, 但它因致命的 GnuTLS 错误而失败。

带有详细日志,

$ GIT_CURL_VERBOSE=1 git clone https://github.com/git/git

Cloning into 'git'...
* Couldn't find host github.com in the .netrc file; using defaults
*   Trying 192.30.252.123...
* Connected to github.com (192.30.252.123) port 443 (#0)
* found 173 certificates in /etc/ssl/certs/ca-certificates.crt
* found 697 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
*    server certificate verification OK
*    server certificate status verification SKIPPED
*    common name: github.com (matched)
*    server certificate expiration date OK
*    server certificate activation date OK
*    certificate public key: RSA
*    certificate version: #3
*    subject: 
*    start date: Thu, 10 Mar 2016 00:00:00 GMT
*    expire date: Thu, 17 May 2018 12:00:00 GMT
*    issuer: C=US,O=DigiCert Inc,OU=www.digicert.com,CN=DigiCert SHA2 Extended Validation Server CA
*    compression: NULL
* ALPN, server accepted to use http/1.1
> GET /git/git/info/refs?service=git-upload-pack HTTP/1.1
Host: github.com
User-Agent: git/2.8.2
Accept: */*
Accept-Encoding: gzip
Accept-Language: en-US, *;q=0.9
Pragma: no-cache

* GnuTLS recv error (-54): Error in the pull function.
* Closing connection 0
fatal: unable to access 'https://github.com/git/git/': GnuTLS recv error (-54): Error in the pull function.

我找到了一些关于GnuTLS recv error (-9) 的报告,但我找不到关于(-54) 的信息。

另一方面,我通过像git clone git@github.com:iTakeshi/...这样的SSH协议成功克隆了我的私有仓库

我确认 git、curl 和 GnuTLS 库已更新到最新版本。

这有什么问题?

【问题讨论】:

    标签: git


    【解决方案1】:

    我花了难以置信的时间解决这个问题(将近 4 个月!)。我不知道为什么某些机器会发生这种情况,但无论如何,您的机器尝试使用您的凭据访问 github,但由于您没有它们,它会抛出那个模糊的错误。

    向您的机器提供凭据:

    1. 转到您的主文件夹和ctrl + h 以显示隐藏文件夹。或者,如果您喜欢终端,请粘贴以下内容:nano ~/.netrcgedit ~/.netrc,具体取决于您的文本编辑器

    2. 在您的 .netrc 文件中,添加以下内容:

          machine github.com
      
          login YOURGITHUBUSERNAME
      
          password YOURGITHUBPASSWORD
      
          machine api.github.com
      
          login YOURGITHUBUSERNAME
      
          password YOURGITHUBPASSWORD
      

    现在,无论何时您将推送到 git,都不会再次提示您提供用户名或密码!

    您可以在此处包含原始密码,但出于安全考虑,请在此处生成身份验证令牌 github token 并将其粘贴到您的密码位置。

    希望这对某人有所帮助

    【讨论】:

      【解决方案2】:

      我对不同的回购有类似的问题。关键是我在 virtualbox 上运行我的 devel linux vm。更新到 virtualbox 5.1.10 后问题解决了。

      更多https://www.virtualbox.org/ticket/16084请查看此标记。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-09-26
        • 1970-01-01
        • 2012-06-18
        • 1970-01-01
        • 1970-01-01
        • 2011-06-11
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多