简体   繁体   English

Git克隆因GnuTLS错误而失败

[英]Git clone fails with GnuTLS error

I tried to clone the git repository on github by git clone https://github.com/git/git.git on ubuntu 16.04, but it failed with a fatal GnuTLS error. 我尝试在ubuntu 16.04上通过git clone https://github.com/git/git.git github上的git存储库,但它因致命的GnuTLS错误而失败。

With verbose log, 用详细日志,

$ 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.

I found some reports for GnuTLS recv error (-9) , but I could not found information about (-54) . 我找到了一些关于GnuTLS recv error (-9) ,但我找不到有关(-54)

On the other hand, I succeeded to clone my private repository by SSH protocol like git clone git@github.com:iTakeshi/... 另一方面,我成功通过SSH协议克隆我的私有存储库,如git clone git@github.com:iTakeshi/...

I confirmed that git, curl, and GnuTLS library are updated to the latest version. 我确认git,curl和GnuTLS库已更新到最新版本。

What's wrong about that? 这有什么不对?

I have similar problem with different repo. 不同的回购我有类似的问题。 The key was that I run my devel linux vm on virtualbox. 关键是我在virtualbox上运行了我的devel linux vm。 After update to virtualbox 5.1.10 the problem solved. 更新到virtualbox 5.1.10后问题解决了。

See this ticke for more https://www.virtualbox.org/ticket/16084 . 有关更多https://www.virtualbox.org/ticket/16084,请参阅此页面。

It took me unbelievably long to solve this (close to 4 months!). 我花了不可思议的长时间来解决这个问题(接近4个月!)。 I don't know why this happens for some machines but anyhow, your machine tries accessing github with your credentials, but since you don't have them, it throws that vague error. 我不知道为什么这会发生在一些机器上,但无论如何,你的机器试图用你的凭证访问github,但是由于你没有它们,它会抛出那个模糊的错误。

To provide the credentials to your machine: 要为您的计算机提供凭据:

  1. Go to your home folder and ctrl + h to show the hidden folders. 转到您的主文件夹,然后按ctrl + h显示隐藏的文件夹。 Or if you love the terminal, paste the following: nano ~/.netrc or gedit ~/.netrc , depending on your text editor 或者,如果您喜欢终端,请粘贴以下内容: nano ~/.netrcgedit ~/.netrc ,具体取决于您的文本编辑器

  2. In your .netrc file, add the following: .netrc文件中,添加以下内容:

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

Now whenever you'll be pushing to git, you won't be prompted to provide your username or password again! 现在无论何时你推送git,都不会再提示你提供你的用户名或密码!

You can include your raw password there but for security purposes, generate an auth token here github token and paste it in place of your password. 您可以在那里包含原始密码,但出于安全考虑,请在此处生成一个身份验证令牌github令牌并粘贴它以代替您的密码。

Hope this helps someone 希望这有助于某人

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM