The error "RPC failed; curl GnuTLS recv error: Error decoding the received TLS packet" generally indicates an issue with the network connection or the TLS/SSL protocol used by Git and Curl.
To resolve the "RPC failed; curl GnuTLS recv error: Error decoding the received TLS packet" error, you can recompile Git using libcurl-openssl-dev
instead of libcurl4-gnutls-dev
.
Remove Git and its dependencies:
sudo apt-get -y purge git
Install necessary dependencies:
sudo apt-get install build-essential fakeroot dpkg-dev
Create a directory for compiling git:
mkdir git-source
cd git-source
open the sources.list
file located in the /etc/apt/
directory using a vim editor:
sudo vi /etc/apt/sources.list
For Debian 12, add the following line:
deb-src http://deb.debian.org/debian bookworm main
deb-src http://deb.debian.org/debian bookworm-updates main
For Ubuntu 22.04, uncomment the following line:
deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted
deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
Then run the following to update the package index files from their sources:
sudo apt-get update
Download git source code:
apt-get source git
Install build dependencies for git:
sudo apt-get build-dep git
Install libcurl4-openssl-dev
package:
sudo apt-get install -y libcurl4-openssl-dev
Enter the git source code directory:
cd git-2.39.2
Change libcurl4-gnutls-dev
to libcurl4-openssl-dev
in ./debian/control
:
sed -i -- 's/libcurl4-gnutls-dev/libcurl4-openssl-dev/' ./debian/control
Edit ./debian/rules
to delete the entire line containing TEST=test
:
sed -i -- '/TEST=test/d' ./debian/rules
Build git from the source code.
sudo dpkg-buildpackage -rfakeroot -b
Back to the ~/git-source
directory:
cd ..
Install the compiled git package:
sudo dpkg -i git_2.39.2-1.1_amd64.deb