git 错误:gnutls_handshake() 推送失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15665444/
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
git error: gnutls_handshake() failed on push
提问by Wahtever
I have been using git for a while with no problems, then suddenly it started throwing this error when using git push
:
我已经使用 git 一段时间了,没有任何问题,然后在使用时突然开始抛出这个错误git push
:
error: gnutls_handshake() failed: A TLS packet with unexpected length was received. while accessing ... fatal: HTTP request failed
错误:gnutls_handshake() 失败:收到了长度意外的 TLS 数据包。访问时...致命:HTTP 请求失败
It was working fine, then suddenly it stopped.
它工作正常,然后突然停止。
What is the problem?
问题是什么?
Thanks
谢谢
采纳答案by niculare
回答by cardonator
The linked discussion on askubuntu references a version number for git that may not match up with your own. Instead of these two lines:
askubuntu 上的链接讨论引用了 git 的版本号,该版本号可能与您自己的不匹配。而不是这两行:
sudo dpkg-source -x git_1.7.9.5-1.dsc
cd git_1.7.9.5 8.
you need to account for the version of git you're using. In my case, it was 1.8.xxxxx.
您需要考虑您正在使用的 git 版本。就我而言,它是 1.8.xxxxx。
sudo dpkg-source -x git_<git-version-number>.dsc
cd git_<git-version-number>
An easy way to get around this is to just copy the first part of the command and then hit Tab to autocomplete. This may not work perfectly if you have recompiled before.
解决这个问题的一个简单方法是复制命令的第一部分,然后按 Tab 键自动完成。如果您之前重新编译过,这可能无法完美运行。
回答by Matija Nalis
In my case same error was caused by completely different thing.
在我的情况下,同样的错误是由完全不同的事情引起的。
Debian was upgraded from Wheezy to Jessie, and thus apache was upgraded 2.2.22 to 2.4.10. git was trying to push to https://www.example.comand it stopped working with error: gnutls_handshake() failed: A TLS packet with unexpected length was received
Debian 从 Wheezy 升级到 Jessie,因此 apache 从 2.2.22 升级到 2.4.10。git 试图推送到https://www.example.com并且它停止使用error: gnutls_handshake() failed: A TLS packet with unexpected length was received
Turns out, www.example.comwas resolving to both IPv4 and IPv6 addresses, and apache config was having <Virtualhost x.y.w.z:443>
IPv4 address only. Changing that to <Virtualhost _default_:443>
fixed the problem.
结果证明,www.example.com正在解析 IPv4 和 IPv6 地址,而 apache 配置<Virtualhost x.y.w.z:443>
只有 IPv4 地址。更改它以<Virtualhost _default_:443>
解决问题。
(just so if it helps somebody else with same problem... only found it after the tedious recompile of git with openssl didn't change anything at all)
(只是这样,如果它可以帮助其他有同样问题的人......只有在用 openssl 对 git 进行繁琐的重新编译后才发现它根本没有改变任何东西)
回答by StSav012
This answermight help. I was surprised that the problems are nowhere to be linked together although the question is old.
这个答案可能会有所帮助。尽管问题很老,但我很惊讶这些问题无处可联系在一起。
Just to be sure the usefull info won't get lost, I copy a brief solution from the question:
为了确保有用的信息不会丢失,我从问题中复制了一个简短的解决方案:
hostname=XXX
port=443
trust_cert_file_location=`curl-config --ca`
sudo bash -c "echo -n | openssl s_client -showcerts -connect $hostname:$port 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' >> $trust_cert_file_location"