Git克隆因GnuTLS错误而失败

时间:2016-05-05 10:14:06

标签: git

我试图在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)的信息。

另一方面,我成功通过SSH协议克隆我的私有存储库,如git clone git@github.com:iTakeshi/...

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

这有什么不对?

2 个答案:

答案 0 :(得分:0)

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

请参阅此ticke获取更多https://www.virtualbox.org/ticket/16084

答案 1 :(得分:0)

解决这个问题花了我不可思议的长时间(接近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
    
  3. 现在,无论何时您推送git,都不会再次提示您提供用户名或密码!

    您可以在那里添加原始密码,但出于安全考虑,请在github token生成身份验证令牌并将其粘贴代替您的密码。

    希望这有助于某人