过去几个月我一直在使用Git。最近,当我尝试克隆或推送时,我不断收到此错误。我已经在互联网上进行了研究,但到目前为止,没有解决方案对我有用。有人有主意吗?
外部注释:现在我搬到了另一个国家,它在我以前的工作中表现良好。 Git版本:2.11.0,操作系统:Debian GNU / Linux 9.11(stretch)
错误:
git push
fatal: unable to access 'https://**************/': gnutls_handshake() failed: Handshake failed
答案 0 :(得分:14)
我在Ubuntu 14.04 LTS中也遇到了这个问题。 最快的解决方案是使用ssh而不是https。 以下是从ssh替换https的步骤:
在服务器上生成ssh key using ssh-keygen。
从步骤1中生成的id_rsa.pub文件中复制公钥,并将其添加到以下链接,具体取决于存储库主机-
Bitbucket-https://bitbucket.org/account/settings/ssh-keys/
现在运行以下命令以从服务器命令行终端测试身份验证
Bitbucket
ssh -T git@bitbucket.org
Github
ssh -T git@github.com
Gitlab
ssh -T git@gitlab.com
转到repo目录并使用emac或vi打开.git / config文件
将远程“原始”网址(以https开头)替换为以下内容-
对于Bitbucket-git@bitbucket.org:<用户名> /
对于Github-git@github.com:<用户名> /
对于Gitlab-git@gitlab.com:<用户名> /
答案 1 :(得分:9)
这是解决方案,可在ubuntu服务器14.04.x上解决此问题
1,编辑文件:
sudo nano /etc/apt/sources.list
2,添加到文件sources.list
deb http://security.ubuntu.com/ubuntu xenial-security main
deb http://cz.archive.ubuntu.com/ubuntu xenial main universe
3,运行命令更新并将CURL更新到新版本
apt-get update && apt-get install curl
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
5,使用bitbucket测试连接(可选)
GIT_CURL_VERBOSE=1 git ls-remote https://bitbucket.org/
Response:
* Closing connection 0
fatal: repository 'https://bitbucket.org/' not found
完成了。
答案 2 :(得分:4)
此错误意味着Git无法与您要使用的服务器建立安全连接。您的Git版本使用GnuTLS库来设置TLS(加密)连接,并且由于某种原因安装过程失败。
这可能有两个原因。一个是您的服务器(您没有提到的服务器)正在使用一组不兼容的密码套件或TLS版本,并且没有共同的加密算法可供选择。您也可能有人通过MITM设备篡改了连接。
您使用的Git和GnuTLS版本应该可以在大多数标准服务器上正常工作。重新安装它没有帮助。您可以尝试升级到Debian的较新版本,也可以尝试使用OpenSSL针对libcurl的版本自己构建Git。您也可以只切换到基于SSH的远程服务器,这将完全避免这种不兼容性。
答案 3 :(得分:2)
我遇到了同样的错误。
您可以尝试使用Paul N. Baker's shell script使用OpenSSL而不是gnutls编译git。
file.sh
chmod a+x file.sh
sudo ./file.sh
此shell脚本对我有用。