【问题标题】:gnutls_handshake() failed: Handshake failed GITgnutls_handshake() 失败:GIT 握手失败
【发布时间】:2020-09-08 07:35:16
【问题描述】:

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

致命:无法访问 'https://username@bitbucket.org/name/repo_name.git/': gnutls_handshake() 失败:握手失败

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

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

在计算机上,操作系统为 Linux mint 17,在 EC2 实例上为 Ubuntu 14.04.6 LTS。

可能是什么问题,我应该怎么做才能解决这个问题?

【问题讨论】:

  • 我面临同样的问题。我的解决方法是重新运行命令直到它成功或改用 SSH。
  • 我多次重新运行该命令,但没有成功,甚至使用 ssh 的新克隆也无法正常工作,我遇到了同样的错误。

标签: linux git ubuntu bitbucket


【解决方案1】:

在使用 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

Atlassian 论坛https://community.atlassian.com/t5/Bitbucket-questions/fatal-unable-to-access-https-bitbucket-org-gnutls-handshake/qaq-p/1468075 上有更多关于该问题的讨论

【讨论】:

  • 很好的答案。我还要补充一点,它有助于我获取有关如何检查我是否有 SSH 密钥以及将该密钥添加到我的 git 提供程序的信息——有关详细信息,请参阅此链接:stackoverflow.com/a/42641637/1818235
【解决方案2】:

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

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

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

  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
    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

【讨论】:

    【解决方案3】:
    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
    

    【讨论】:

      猜你喜欢
      • 2013-03-17
      • 2021-02-25
      • 2018-07-28
      • 2017-06-19
      • 2023-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多