gnutls_handshake() failed: Handshake failed GIT

雨燕双飞 提交于 2021-01-27 10:24:53

问题


Everything was working fine but suddenly I am getting the error:

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

I am getting this on my computer as well as an EC2 instance. When I tried on another computer then it is working fine there.

I have tried many solutions from Stackoverflow and from other forums. but nothing worked!

On the computer, os is Linux mint 17 and on EC2 instance, Ubuntu 14.04.6 LTS.

What can be the issue and what should I do to fix this issue?


回答1:


Ran into the same issue on a server with Ubuntu 14.04, and found that on Aug 24, 2020 bitbucket.org changed to no longer allow old ciphers, see https://bitbucket.org/blog/update-to-supported-cipher-suites-in-bitbucket-cloud

This affects https:// connections to bitbucket, but does not affect ssh connections, so the quickest solution for me was to add an ssh key to bitbucket, and then change the remote from https to ssh.

The steps to change the remote I found from here, and they are essentially:

# 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

There is more discussion about the issue on the Atlassian forums at https://community.atlassian.com/t5/Bitbucket-questions/fatal-unable-to-access-https-bitbucket-org-gnutls-handshake/qaq-p/1468075




回答2:


The quickest solution is to use SSH instead of HTTPS. I tried other ways to fix the issue but it was not working.

The following are steps to replace HTTPS from SSH:

  1. Generate ssh key using ssh-keygen on the server.

  2. Copy the public key from the generated id_rsa.pub file from step 1 and add it at following links depending on the repository host -

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

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

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

  3. Now run the following command to test authentication from the server command line terminal

    Bitbucket

    ssh -T git@bitbucket.org
    Github
    ssh -T git@github.com
    Gitlab
    ssh -T git@gitlab.com
  4. Go to the repo directory and open .git/config file using emac or vi or nano

  5. Replace remote "origin" URL (which starts with https) with the following -

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

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

    For Gitlab - git@gitlab.com:<username>/<repo>.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


来源:https://stackoverflow.com/questions/63789181/gnutls-handshake-failed-handshake-failed-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!