[翻译]解决使用 git clone 命令时出现的 ‘gnutls

编程入门 行业动态 更新时间:2024-10-24 19:26:42

[翻译]解决使用 git clone <a href=https://www.elefans.com/category/jswz/34/1771323.html style=命令时出现的 ‘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 failing

This 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

本文发布于:2024-03-06 12:54:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1715383.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令   git   clone   gnutls

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!