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
It seems there is a problem with the
gnutls
package. As a workaround, you can try to compilegit
withopenssl
. More info on how to accomplish this you can find here.The linked discussion on askubuntu references a version number for git that may not match up with your own. Instead of these two lines:
you need to account for the version of git you're using. In my case, it was 1.8.xxxxx.
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.
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)
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:
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.