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.
- Install build-essential, fakeroot and dpkg-dev using the following command.
sudo apt-get install build-essential fakeroot dpkg-dev
- Create a directory named git-rectify in the home folder using the following command.
mkdir ~/git-rectify
- CD in to the get-rectify directory and get the git source files.
cd ~/git-rectify
apt-get source git
- Install all the git dependencies.
sudo apt-get build-dep git
- Install libcurl with all development files.
sudo apt-get install libcurl4-openssl-dev
- 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
- 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β
- Build the package files using the following command.
sudo dpkg-buildpackage -rfakeroot -b
- 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.