AnswerBun.com

"error: gnutls_handshake() failed" when connecting to https servers

Ask Ubuntu Asked by Nyambaa on November 30, 2020

When I try to connect to any HTTPS server with git, it gives the following error:

error: gnutls_handshake() failed: A TLS packet with unexpected length was received. while accessing ...
fatal: HTTP request failed

I think that maybe some packages that are related to gnutls_handshake have been broken. So, I want to reinstall those.

Which packages can be related to these errors? Or how do I fix this kind of error?

3 Answers

This is mentioned in one of the comments to another answer but I feel it needs to be more visible https://askubuntu.com/users/177551/paul-nelson-baker has written a shell script which, for me, resolved this issue.

The script is available in his repository https://github.com/paul-nelson-baker/git-openssl-shellscript and re-compiles git with openssl instead of gnutls. Read the README for the whole story but it worked for me so thank you Paul.

Answered by glaucon on November 30, 2020

For me, it ended up being that SSL certificate was self-signed. Give this a try

git config --global http.sslVerify false

Answered by Rick on November 30, 2020

Got reason of the problem, it was gnutls package. It's working weird behind a proxy. But openssl is working fine even in weak network. So workaround is that we should compile git with openssl. To do this, run the following commands:

sudo apt-get update
sudo apt-get install build-essential fakeroot dpkg-dev
sudo apt-get build-dep git
mkdir ~/git-openssl
cd ~/git-openssl
apt-get source git
dpkg-source -x git_1.7.9.5-1.dsc
cd git-1.7.9.5

(Remember to replace 1.7.9.5 with the actual version of git in your system.)

Then, edit debian/control file (run the command: gksu gedit debian/control) and replace all instances of libcurl4-gnutls-dev with libcurl4-openssl-dev.

Then build the package (if it's failing on test, you can remove the line TEST=test from the file debian/rules):

sudo apt-get install libcurl4-openssl-dev
sudo dpkg-buildpackage -rfakeroot -b

Install new package:

i386: sudo dpkg -i ../git_1.7.9.5-1_i386.deb

x86_64: sudo dpkg -i ../git_1.7.9.5-1_amd64.deb


Inspired from here: https://github.com/xmendez/wfuzz/wiki/PyCurlSSLBug

Answered by Nyambaa on November 30, 2020

Add your own answers!

Related Questions

Ubuntu 20.04 : error when installing Caffe

1  Asked on February 4, 2021 by ignis-oculo

         

Bash script for copying only modified files

0  Asked on February 4, 2021 by indr0

     

Ubuntu 20.04 start up screen

0  Asked on February 3, 2021 by pradeep-jha

     

Accessing Windows 10 files from Ubuntu 20.04

2  Asked on February 2, 2021 by johnw

         

how prevent ubuntu 18.04 LTS remove apache2 on startup?

0  Asked on January 31, 2021 by sergiomb

   

9 dots Show Application menu stucks once in a while in ubuntu 20.04.1

0  Asked on January 31, 2021 by jobayer-shajal

 

Screen rotation shortcuts in login without editing files

1  Asked on January 30, 2021 by schrodigerscatcuriosity

         

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir