gnutls_handshake() 失败:握手失败GIT

gnutls_handshake() failed: Handshake failed GIT

一切正常,但突然出现错误:

fatal: unable to access 'https://username@bitbucket.org/name/repo_name.git/': gnutls_handshake() failed: Handshake failed

我在我的计算机和一个 EC2 实例上都得到了这个。当我在另一台计算机上尝试时,它在那里工作正常。

我已经尝试了来自 Whosebug 和其他论坛的许多解决方案。但没有任何效果!

在计算机上,os 是 Linux mint 17,在 EC2 实例上,Ubuntu 14.04.6 LTS。

可能是什么问题,我应该如何解决这个问题?

运行 在 Ubuntu 14.04 的服务器上遇到同样的问题,发现在 2020 年 8 月 24 日 bitbucket.org 更改为不再允许旧密码,请参阅 https://bitbucket.org/blog/update-to-supported-cipher-suites-in-bitbucket-cloud

这会影响到 bitbucket 的 https:// 连接,但不会影响 ssh 连接,所以对我来说最快的解决方案是 add an ssh key to bitbucket,然后将远程从 https 更改为 ssh。

我从 here 找到的更改遥控器的步骤,它们基本上是:

# Find the current remote
git remote -v

origin  https://user@bitbucket.org/reponame.git (fetch)
origin  https://user@bitbucket.org/reponame.git (push)

# Change the remote to ssh
git remote set-url origin git@bitbucket.org:reponame.git

# Check the remote again to make sure it changed
git remote -v

https://community.atlassian.com/t5/Bitbucket-questions/fatal-unable-to-access-https-bitbucket-org-gnutls-handshake/qaq-p/1468075

的 Atlassian 论坛上有更多关于此问题的讨论

最快的解决方案是使用 SSH 而不是 HTTPS。我尝试了其他方法来解决这个问题,但没有用。

以下是从 SSH 替换 HTTPS 的步骤:

  1. 在服务器上生成ssh key using ssh-keygen

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

    比特桶 - 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
    
    Github
    ssh -T git@github.com
    
    Gitlab
    ssh -T git@gitlab.com
    

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

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

    对于 Bitbucket - git@bitbucket.org:/.git

    对于 Github - git@github.com:/.git

    对于Gitlab - git@gitlab.com:/.git

sudo bash

mkdir upgrade

cd upgrade

wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz

tar xpvfz openssl-1.1.1g.tar.gz

cd openssl-1.1.1g

./Configure 

make ; make install

cd ..

wget https://curl.haxx.se/download/curl-7.72.0.tar.gz

tar xpvfz curl-7.72.0.tar.gz

cd curl.7.72.0

./configure --with-ssl=/usr/local/ssl

make ; make install

cd ..

git clone https://github.com/git/git 

cd git

vi Makefile, change prefix= line to /usr instead of home

make ; make install