致命:无法访问“.....”:gnutls_handshake() 失败:握手失败

Har*_*nna 18 git github handshake gitlab

过去几个月我一直在使用 Git。最近,当我尝试克隆或推送时,我不断收到此错误。我已经在互联网上进行了研究,但到目前为止没有任何解决方案对我有用。有没有人有想法?

外部说明:现在我搬到了不同的国家,它在我以前的地方工作得很好。Git 版本:2.11.0,操作系统:Debian GNU/Linux 9.11(扩展)

错误 :

git push
fatal: unable to access 'https://**************/': gnutls_handshake() failed: Handshake failed
Run Code Online (Sandbox Code Playgroud)

Jig*_*att 30

这是在 ubuntu 服务器 14.04.x 上解决此问题的解决方案

1、编辑文件:

sudo nano  /etc/apt/sources.list
Run Code Online (Sandbox Code Playgroud)

2、添加到文件sources.list

deb http://security.ubuntu.com/ubuntu xenial-security main
deb http://cz.archive.ubuntu.com/ubuntu xenial main universe
Run Code Online (Sandbox Code Playgroud)

3,运行命令更新并将CURL更新到新版本

apt-get update && apt-get install curl
Run Code Online (Sandbox Code Playgroud)

4、检查版本(可选):

curl -V
Response :

curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets 
Run Code Online (Sandbox Code Playgroud)

5、测试连接bitbucket(可选)

GIT_CURL_VERBOSE=1 git ls-remote https://bitbucket.org/
Response:


* Closing connection 0
fatal: repository 'https://bitbucket.org/' not found
Run Code Online (Sandbox Code Playgroud)

这样做了。

  • 最佳答案!问题是关于修复 git http pull/push - 不是如何使用 SSH 密钥。 (2认同)
  • 和作者有同样的问题。这为我解决了这个问题。非常感谢! (2认同)

Ami*_*wal 19

我在 Ubuntu 14.04 LTS 上也遇到了这个问题。最快的解决方案是使用 ssh 而不是 https。以下是从 ssh 替换 https 的步骤:

  1. 在服务器上使用 ssh-keygen生成ssh 密钥

  2. 从步骤 1 中生成的 id_rsa.pub 文件中复制公钥,并根据存储库主机将其添加​​到以下链接中 -

    Bitbucket - https://bitbucket.org/account/settings/ssh-keys/

    Github - https://github.com/settings/ssh/new

    Gitlab - https://gitlab.com/profile/keys

  3. 现在运行以下命令以从服务器命令行终端测试身份验证

    比特桶

    ssh -T git@bitbucket.org
    Run Code Online (Sandbox Code Playgroud) GitHub
    ssh -T git@github.com
    Run Code Online (Sandbox Code Playgroud) GitLab
    ssh -T git@gitlab.com
    Run Code Online (Sandbox Code Playgroud)

  4. 转到 repo 目录并使用 emac 或 vi 打开 .git/config 文件

  5. 将远程“来源”网址(以 https 开头)替换为以下内容 -

    对于 Bitbucket - git@bitbucket.org:<username>/<repo>.git

    对于 Github - git@github.com:<username>/<repo>.git

    对于 Gitlab - git@gitlab.com:<username>/<repo>.git

  • 这是迄今为止最简单的解决方案。确实写得很好的答案。 (4认同)

bk2*_*204 7

此错误意味着 Git 无法与您尝试使用的服务器建立安全连接。您的 Git 版本使用 GnuTLS 库来设置 TLS(加密)连接,并且由于某种原因设置过程失败。

这可能有几个原因。一个是您的服务器(您没有提到的那个)正在使用一组不兼容的密码套件或 TLS 版本,并且没有可以选择的通用加密算法。也有可能有人通过 MITM 设备篡改了连接。

您使用的 Git 和 GnuTLS 版本应该适用于大多数标准服务器。重新安装也没有用。您可以尝试升级到较新版本的 Debian,或者您可以尝试使用 OpenSSL 针对 libcurl 版本自己构建 Git。您也可以只切换到基于 SSH 的遥控器,这将完全避免这种不兼容性。