Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git clone error: gnutls_handshake() failed: An unexpected TLS packet was received

I am running Ubuntu 18.04 LTS on armv7l. I am running git clone inside a proxy (I got the proxy variables set properly), but now I get this;

fatal: unable to access '<my_git>.git/': gnutls_handshake() failed: An unexpected TLS packet was received.

It used to work in Ubuntu 16.04. I have checked this solution but it does not work for me. All I am trying to do is to git clone.

like image 656
Rock Avatar asked Jun 28 '18 17:06

Rock


2 Answers

Finally found the answer. It seems that I have to do:

git config --global http.proxy http://<my_proxy>:<my_port>
git config --global https.proxy https://<my_proxy>:<my_port>

Spent quick some time on this but luckily it works in the end. I thought this would be hard to fix but it turns out to be some commands that I never did before on Ubuntu 16.04.

like image 171
Rock Avatar answered Oct 15 '22 20:10

Rock


Might be issue with gnutls Package. we have to compile a git Package with openssl instead of gnutls. Follow the below steps,

sudo apt-get install -y build-essential fakeroot dpkg-dev
sudo apt-get -y build-dep git
sudo apt-get install -y libcurl4-openssl-dev

mkdir git-openssl
cd git-openssl
apt-get source git
cd git-*
sed -i -e 's/libcurl4-gnutls-dev/libcurl4-openssl-dev/g' ./debian/control
sed -i -- '/TEST\s*=\s*test/d' ./debian/rules
sudo dpkg-buildpackage -rfakeroot -b
sudo dpkg -i git_2.7.4-0ubuntu1.6_arm64.deb

#CleanUp
cd ../../
sudo rm -rf git-openssl

You can follow This Bog or You can find simple script here to do that

like image 44
nullbyte91 Avatar answered Oct 15 '22 20:10

nullbyte91