git clone: GnuTLS recv 错误 (-9): 收到了长度意外的 TLS 数据包

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31044234/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 11:09:10  来源:igfitidea点击:

git clone: GnuTLS recv error (-9): A TLS packet with unexpected length was received

gitubuntussl

提问by Amith Jayasekara

I'm trying to clone a git repository and I'm receiving following error while executing the command:

我正在尝试克隆 git 存储库,但在执行命令时收到以下错误:

GnuTLS recv error (-9): A TLS packet with unexpected length was received.

My client machine is a Ubuntu 14.04.

我的客户端机器是 Ubuntu 14.04。

回答by Eranga Kodikara

This is Known bug as @Ivan Ternovtsiy said ,but there is workaround

这是@Ivan Ternovtsiy 所说的已知错误,但有解决方法

Remove current GIT from your system

从系统中删除当前的 GIT

 sudo apt-get purge git

Download GIT deb git_1.9.1-1_amd64.deb link

下载 GIT deb git_1.9.1-1_amd64.deb链接

Execute the downloaded DEB.

执行下载的 DEB。

回答by iamdsy

If you are in china,may be you should set proxy for git,for example

如果你在 CN ,可能你应该为 git 设置代理,例如

git config --global https.proxy 'socks5://127.0.0.1:9999'

回答by hsandt

Your mileage may vary, but in my case I was suspecting two factors:

您的里程可能会有所不同,但就我而言,我怀疑有两个因素:

  • low download speed -> connection too long on big repository
  • my Internet provider doesn't like long connections and closes them
  • 下载速度低 -> 大存储库上的连接时间过长
  • 我的互联网提供商不喜欢长连接并关闭它们

So I decided to change Internet provider andpick a higher bandwidth. It's working fine now. I'm not sure if only changing provider orpicking a higher bandwidth would have been enough, so you'd have to try out.

所以我决定更换互联网提供商选择更高的带宽。它现在工作正常。我不确定仅更改提供商选择更高的带宽是否就足够了,因此您必须尝试一下。

Note: I used to use a workaround I mentioned in another questionwhich is about shallow cloning, and that made me think that shorter connections may work.

注意:我曾经使用我在另一个关于浅克隆的问题提到的解决方法,这让我认为更短的连接可能有效。