Reputation: 3678
I have been using git for a while with no problems, then suddenly it started throwing this error when using git push
:
error: gnutls_handshake() failed: A TLS packet with unexpected length was received. while accessing ... fatal: HTTP request failed
It was working fine, then suddenly it stopped.
What is the problem?
Thanks
Upvotes: 6
Views: 21152
Reputation: 321
I have also faced the same issue which was fixed later by disabling my Kaspersky antivirus in my local machine. I hope this may be helpful to others.
Upvotes: 1
Reputation: 786
This answer might help. I was surprised that the problems are nowhere to be linked together although the question is old.
Just to be sure the usefull info won't get lost, I copy a brief solution from the question:
hostname=XXX
port=443
trust_cert_file_location=`curl-config --ca`
sudo bash -c "echo -n | openssl s_client -showcerts -connect $hostname:$port 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' >> $trust_cert_file_location"
Upvotes: 1
Reputation: 737
In my case same error was caused by completely different thing.
Debian was upgraded from Wheezy to Jessie, and thus apache was upgraded 2.2.22 to 2.4.10. git was trying to push to https://www.example.com and it stopped working with error: gnutls_handshake() failed: A TLS packet with unexpected length was received
Turns out, www.example.com was resolving to both IPv4 and IPv6 addresses, and apache config was having <Virtualhost x.y.w.z:443>
IPv4 address only. Changing that to <Virtualhost _default_:443>
fixed the problem.
(just so if it helps somebody else with same problem... only found it after the tedious recompile of git with openssl didn't change anything at all)
Upvotes: 1
Reputation: 396
The linked discussion on askubuntu references a version number for git that may not match up with your own. Instead of these two lines:
sudo dpkg-source -x git_1.7.9.5-1.dsc
cd git_1.7.9.5 8.
you need to account for the version of git you're using. In my case, it was 1.8.xxxxx.
sudo dpkg-source -x git_<git-version-number>.dsc
cd git_<git-version-number>
An easy way to get around this is to just copy the first part of the command and then hit Tab to autocomplete. This may not work perfectly if you have recompiled before.
Upvotes: 1