[Solution] gnutls_handshake() failed GIT repository – AWS codecommit

gnutls_handshake() failed

Note: This solution is not just limited to codecommit but also for other Ubuntu gnults_handshake related issues.

If you have AWS cli installed in ubuntu 14.04 and working with AWS codecommit, you are likely to get “gnutls_handshake() failed” error when you try to clone a repository created in codecommit. Do not worry about it, we have a solution for it.

[Solution] gnutls_handshake() failed

Follow the steps given below to rectify this issue.

1. Install build-essential, fakeroot and dpkg-dev using the following command.

sudo apt-get install build-essential fakeroot dpkg-dev

2. Create a directory named git-rectify in the home folder using the following command.

mkdir ~/git-rectify

3. CD in to the get-rectify directory and get the git source files.

cd ~/git-rectify
apt-get source git

4. Install all the git dependencies.

sudo apt-get build-dep git

5. Install libcurl with all development files.

sudo apt-get install libcurl4-openssl-dev

6. Unpack all the source packages using the following command.

Note: The name “git_1.9.1-1ubuntu0.1” could vary based on the lastest version. So look in to the directory for the correct version name.

 dpkg-source -x git_1.9.1-1ubuntu0.1

7. Cd in to “git_1.9.1” folder and open the control file located inside debian folder (git_1.9.1/debian/control) in a text editor. Replace all the occurences of “libcurl4-gnutls-dev” to “libcurl4-openssl-dev”. Also open “debian/rules” file and delete the line “TEST=test”

8. Build the package files using the following command.

sudo dpkg-buildpackage -rfakeroot -b

9. Install the new git package by executing the folling command.

Note: The package name is based on the system architecture. So have a look at the package name located in “git_1.9.1” (could be a different name for you) folder.

sudo dpkg -i git_1.7.9.5-1_amd64.deb

Thats it! Now you will be able to clone and do all the git related activities to your codecommit service. Lets us know if you are not able to rectify the issue after performing all the above mentioned steps.

  1. Hi,
    I’m using ubuntu 20.04.1.
    when perform
    sudo dpkg-buildpackage -rfakeroot -b

    I got this message error, could you help?
    dpkg-buildpackage: error: cannot open file debian/changelog: No such file or directory

  2. Here is a script the performs the steps above (including the text editing). Note that your versions of some tools may vary. I didn’t need the commented lines, you might.
    mkdir ~/git-rectify
    cd ~/git-rectify
    sudo cp /etc/apt/sources.list /etc/apt/sources.list~
    sudo sed -Ei ‘s/^# deb-src /deb-src /’ /etc/apt/sources.list
    sudo apt-get update
    apt-get source git
    sudo apt-get build-dep -y git
    sudo apt-get install -y libcurl4-openssl-dev
    #dpkg-source -x git_2.17.1-1ubuntu0.9.dsc
    sed -i -e ‘s/libcurl4-gnutls-dev/libcurl4-openssl-dev/g’ ./git-2.17.1/debian/control || echo “No gnutls references in debian/control to rename as openssl”
    sed -i -e ‘s/TEST =test//g’ git-2.17.1/debian/rules || echo “No TEST=test line to remove in debian/rules”
    cd git-2.17.1/
    sudo dpkg-buildpackage -rfakeroot -b
    cd ..
    #sudo apt-get -f install
    sudo dpkg -i git-man_2.17.1-1ubuntu0.9_all.deb
    sudo dpkg -i git_2.17.1-1ubuntu0.9_amd64.deb

  3. i got this error when dpkg-source
    dpkg-source: error: cannot read git_1.9.1-1ubuntu0.1: No such file or directory

  4. i got this error message after typing this command
    sudo dpkg-buildpackage -rfakeroot -b
    dpkg-buildpackage: warning: using a gain-root-command while being root
    dpkg-buildpackage: info: source package git
    dpkg-buildpackage: info: source version 1:2.25.1-1ubuntu3
    dpkg-buildpackage: info: source distribution focal
    dpkg-buildpackage: info: source changed by Marc Deslauriers
    dpkg-buildpackage: info: host architecture amd64
    dpkg-source –before-build .
    fakeroot debian/rules clean
    dh clean –with apache2
    debian/rules override_dh_auto_clean
    /usr/bin/make -C contrib/mw-to-git clean NO_OPENSSL=1 prefix=/usr gitexecdir=/usr/lib/git-core libexecdir=/usr/lib/git-core mandir=/usr/share/man htmldir=/usr/share/doc/git/html INSTALLDIRS=vendor SANE_TOOL_PATH= INSTALL=install TAR=tar NO_CROSS_DIRECTORY_HARDLINKS=1 NO_INSTALL_HARDLINKS=1 NO_PERL_CPAN_FALLBACKS=1 PYTHON_PATH=/usr/bin/python3 DEFAULT_PAGER=pager DEFAULT_EDITOR=editor CC=’gcc’ CFLAGS=’-Wall -g -O2 -fdebug-prefix-map=/home/dell/git-rectify=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2′ LDFLAGS=’-Wl,-Bsymbolic-functions -Wl,-z,relro’ HOST_CPU=’x86_64′ V=1 USE_LIBPCRE2=1
    make[2]: Entering directory ‘/home/dell/git-rectify’
    make[2]: *** contrib/mw-to-git: No such file or directory. Stop.
    make[2]: Leaving directory ‘/home/dell/git-rectify’
    make[1]: *** [debian/rules:92: override_dh_auto_clean] Error 2
    make: *** [debian/rules:56: clean] Error 2
    dpkg-buildpackage: error: fakeroot debian/rules clean subprocess returned exit status 2

  5. error: RPC failed; curl 56 OpenSSL SSL_read: error:140943FC:SSL routines:ssl3_read_bytes:sslv3 alert ba
    d record mac, errno 0
    fatal: The remote end hung up unexpectedly

    more error :’)

  6. Unfortunately when i put:
    dpkg-source -x git_2.17.1-1ubuntu0.5.dsc
    i get the below errors:
    gpgv: Firma eseguita lun 09 dic 2019 16:00:48 CET
    gpgv: con RSA chiave 50C4A0DDCF31E452CEB19B516569D855A744BE93
    gpgv: Impossibile controllare la firma: Nessuna chiave pubblica
    dpkg-source: Avviso: failed to verify signature on ./git_2.17.1-1ubuntu0.5.dsc
    dpkg-source: Informazioni: extracting git in git-2.17.1
    dpkg-source: Errore: unpack target exists: git-2.17.1

    It’s italian, but similar to english: chiave = key, impossibile controllare la firma = problems with he signature, nessuna chiave pubblica = no public key

    Someone can help me?

  7. You may need to install (for instance, under Ubuntu 16.04), the following packages:apt install libpcre3-dev libexpat1-dev

  8. When,
    apt-get source git
    I got:

    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    NOTICE: ‘git’ packaging is maintained in the ‘Git’ version control system at:
    Need to get 4,065 kB of source archives.
    Get:1 http://security.debian.org/ jessie/updates/main git 1:2.1.4-2.1+deb8u7 (dsc) [2,846 B]
    Err http://security.debian.org/ jessie/updates/main git 1:2.1.4-2.1+deb8u7 (tar)
    Connection failed [IP: 80]
    Get:2 http://security.debian.org/ jessie/updates/main git 1:2.1.4-2.1+deb8u7 (diff) [517 kB]
    Fetched 520 kB in 2min 58s (2,913 B/s)
    E: Failed to fetch http://security.debian.org/pool/updates/main/g/git/git_2.1.4.orig.tar.xz Connection failed [IP: 80]

    E: Failed to fetch some archives.

    Do you know how to solve this?

  9. apt-get source git
    for this command it shows : E: You must put some ‘source’ URIs in your sources.list

  10. Now I am getting the below error.Please help
    error: RPC failed; curl 18 transfer closed with outstanding read data remaining
    fatal: The remote end hung up unexpectedly
    fatal: early EOF
    fatal: index-pack failed

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like