[英]error: gnutls_handshake() failed GIT repository
The following error appears when I try to clone git repository. 我尝试克隆git存储库时出现以下错误。 I have the rsa public keys configured properly as well.
我也正确配置了rsa公钥。
$ git clone https://github.com/blah/blah.git
Initialized empty Git repository in /home/arun/.git/
error: gnutls_handshake() failed: A TLS packet with unexpected length was
received. while accessing https://github.com/blah/blah.git/info/refs
fatal: HTTP request failed
It could be used to a GnuTLs or pycurl bug 它可以用于GnuTL或pycurl bug
The following is the new method for pycurl_7.19.0-4ubuntu3:
以下是pycurl_7.19.0-4ubuntu3的新方法:
sudo apt-get install build-essential fakeroot dpkg-dev
mkdir ~/python-pycurl-openssl
cd ~/python-pycurl-openssl
sudo apt-get source python-pycurl
sudo apt-get build-dep python-pycurl
sudo apt-get install libcurl4-openssl-dev
sudo dpkg-source -x pycurl_7.19.0-4ubuntu3.dsc
cd pycurl-7.19.0
# remove the HAVE_CURL_GNUTLS=1 in the following file
sudo vim debian/patches/10_setup.py.dpatch
# remove the HAVE_CURL_GNUTLS=1 in the following file
sudo vim setup.py
# replace all gnutls into openssl in the following file
sudo vim debian/control
sudo dpkg-buildpackage -rfakeroot -b
sudo dpkg -i ../python-pycurl_7.19.0-4ubuntu3_amd64.deb
I had this problem, and it took me a while to find the solution. 我有这个问题,我花了一段时间才找到解决方案。 I kept thinking that I was missing a package somewhere.
我一直以为我在某个地方错过了一个包裹。 I didn't want to recompile Git, since I was already using the latest version, and I was pretty sure that the problem wasn't Git itself.
我不想重新编译Git,因为我已经在使用最新版本了,我很确定问题不是Git本身。
My problem was my .gitconfig
file. 我的问题是我的
.gitconfig
文件。 The problem only occurred on an old Linux server that had been upgraded many times over the years. 问题只发生在多年来多次升级的旧Linux服务器上。 At some point, for some reason I don't recall, I had explicitly specified
sslVersion = sslv3
in my .gitconfig
file. 在某些时候,由于某些原因我不记得,我已经在我的
.gitconfig
文件中明确指定了sslVersion = sslv3
。
When I saw that, the lightbulb went on, since I know that SSL V3 has been deprecated due to security concerns, and that most people should be using TLS instead. 当我看到它时,灯泡继续,因为我知道SSL V3因安全问题而被弃用,并且大多数人应该使用TLS。 For instance, see RFC 7568, https://tools.ietf.org/html/rfc7568
例如,请参阅RFC 7568, https: //tools.ietf.org/html/rfc7568
So my fix involved either deleting the offending sslVersion = sslv3
line from my ~/.gitconfig
file, or changing this: 所以我的修复涉及从我的
~/.gitconfig
文件中删除有问题的sslVersion = sslv3
行,或更改此:
[httpd]
sslVersion = sslv3
to this: 对此:
[httpd]
sslVersion = tlsv1.2
Removing the line and letting Git/libcurl negotiate the encryption seemed like the best choice, since TLS v1.3 is in the works, and I don't want to encounter this problem again in the future! 删除该行并让Git / libcurl协商加密似乎是最好的选择,因为TLS v1.3正在开发中,我不希望将来再次遇到这个问题!
In My case, It appears I was not using pycurl, so the above solution did not work for me. 在我的情况下,似乎我没有使用pycurl,所以上述解决方案对我不起作用。 What DID work was a rebuild of git-core modified to use openssl instead of gnutls.
什么DID工作是重建git-core修改为使用openssl而不是gnutls。
Instructions are here: 说明在这里:
https://askubuntu.com/questions/186847/error-gnutls-handshake-falied https://askubuntu.com/questions/186847/error-gnutls-handshake-falied
I had substitute "git-core" for "git" in most places, the .dsc (package information file?) turned up as git-core_1.7.0.4-1ubuntu0.2.dsc, and the .deb package came out as git-core_1.7.0.4-1ubuntu0.2_i386.deb. 我在大多数地方用“git-core”代替“git”,.dsc(包信息文件?)显示为git-core_1.7.0.4-1ubuntu0.2.dsc,而.deb包出现了混帐core_1.7.0.4-1ubuntu0.2_i386.deb。
I've had the same problem when tried sudo git fetch
from a directory my own user didn't have enough rights to. 当我从我自己的用户没有足够权限的目录中尝试
sudo git fetch
时,我遇到了同样的问题。 I moved repository to /tmp
and continued my work. 我将存储库移动到
/tmp
并继续我的工作。
Don't forget /tmp
gets erased after reboot. 不要忘记
/tmp
在重启后会被删除。
For me, it ended up being that SSL certificate was self-signed. 对我来说,最终是SSL证书是自签名的。 Give this a try
试一试
git config --global http.sslVerify false
In my case worked, mixing the solutions of @Rick and @m0j0 在我的案例中,混合@Rick和@ m0j0的解决方案
First execute these commands: 首先执行以下命令:
git config --global http.sslVerify false
git config --global http.sslVerify true
After add or modify ~/.gitconfig
添加或修改
~/.gitconfig
nano ~/.gitconfig
Set this: 设置此:
[httpd]
sslVersion = sslv3
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.