命令时出现的 ‘gnutls"/>
[翻译]解决使用 git clone 命令时出现的 ‘gnutls
错误介绍
使用 git clone 时出现如下错误:
fatal: unable to access '.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated.
- Ubuntu 18.04.5 LTS
- Git version:git version 2.17.1
原因
参考bk2204的回答:
This error means that Git cannot establish a secure connection to the
server you’re trying to use. Your version of Git uses the GnuTLS
library to set up TLS (encrypted) connections, and for some reason
that setup process is failingThis could be for a couple of reasons. One is that your server (which
one you haven’t mentioned) is using an incompatible set of cipher
suites or TLS versions, and there’s no encryption algorithms in common
that can be chosen. It’s also possible that you have someone tampering
with the connection via a MITM device.The version of Git and GnuTLS you’re using should work just fine with
most standard servers. Re-installing it won’t help. You can try
upgrading to a newer version of Debian, or you can try building Git
yourself against a version of libcurl using OpenSSL. You can also just
switch to SSH-based remotes, which will avoid this incompatibility
altogether.
解决方案
方法1
使用http
取代https
方法2
取消对 https 的验证
git config --global http.sslVerify false
方法3
Recompile the local git version with ssl: (Remember to replace 1.7.9.5 with the actual version of git in your system.)
sudo apt-get update
sudo apt-get install build-essential fakeroot dpkg-dev
sudo apt-get build-dep git
mkdir ~/git-openssl
cd ~/git-openssl
apt-get source git
dpkg-source -x git_1.7.9.5-1.dsc
cd git-1.7.9.5
更多推荐
[翻译]解决使用 git clone 命令时出现的 ‘gnutls
发布评论