Usm*_*ool 7 linux git ubuntu bitbucket
一切正常,但突然间我收到错误消息:
致命:无法访问“https://username@bitbucket.org/name/repo_name.git/”:gnutls_handshake() 失败:握手失败
我在我的电脑和一个 EC2 实例上得到了这个。当我在另一台计算机上尝试时,它在那里工作正常。
我已经尝试了 Stackoverflow 和其他论坛的许多解决方案。但没有任何效果!
在计算机上,os 是 Linux mint 17,在 EC2 实例上,Ubuntu 14.04.6 LTS。
可能是什么问题,我应该怎么做才能解决这个问题?
小智 8
在装有 Ubuntu 14.04 的服务器上遇到同样的问题,发现在 2020 年 8 月 24 日,bitbucket.org 更改为不再允许使用旧密码,请参阅https://bitbucket.org/blog/update-to-supported-cipher-位桶云中的套件
这会影响 https:// 到 bitbucket 的连接,但不会影响 ssh 连接,所以对我来说最快的解决方案是向 bitbucket 添加一个 ssh 密钥,然后将远程从 https 更改为 ssh。
我从这里找到的更改遥控器的步骤基本上是:
# 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
Run Code Online (Sandbox Code Playgroud)
在https://community.atlassian.com/t5/Bitbucket-questions/fatal-unable-to-access-https-bitbucket-org-gnutls-handshake/qaq-p/的 Atlassian 论坛上有更多关于这个问题的讨论1468075
最快的解决方案是使用SSH而不是HTTPS。我尝试了其他方法来解决该问题,但没有奏效。
以下是从SSH替换HTTPS 的步骤:
在服务器上使用 ssh-keygen生成ssh 密钥。
从步骤 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
现在运行以下命令从服务器命令行终端测试身份验证
比特桶
ssh -T git@bitbucket.orgRun Code Online (Sandbox Code Playgroud)
GitHub
ssh -T git@github.comRun Code Online (Sandbox Code Playgroud)
GitLab
ssh -T git@gitlab.comRun Code Online (Sandbox Code Playgroud)
转到 repo 目录并使用 emac 或 vi 或 nano 打开 .git/config 文件
将远程“来源”URL(以 https 开头)替换为以下内容 -
对于Bitbucket - git@bitbucket.org:<username>/<repo>.git
对于Github - git@github.com:<username>/<repo>.git
对于Gitlab - git@gitlab.com:<username>/<repo>.git