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.
The problem seems to be a problem with Ubuntu gnutls_handshake
recompile git
Use libcurl-openssl-dev
to replace gnutls
Install the necessary dependencies and environment
sudo apt-get install build-essential fakeroot dpkg-dev
Create a directory to put the newly compiled git
mkdir ~/git-rectify
Get git source code
cd ~/git-rectify
sudo apt-get source git
Install git dependencies
sudo apt-get build-dep git
Install libcurl
sudo apt-get install libcurl4-openssl-dev
Enter the git directory, where the directory name depends on the version you installed
cd git-2.7.4/
Recompile git after modifying two files
vim ./debian/control # Modify libcurl4-gnutls-dev to libcurl4-openssl-dev
vim ./debian/rules # delete the entire line of TEST=test
sudo dpkg-buildpackage -rfakeroot -b
Go back to the previous directory and install the compiled installation package
cd .. # is in the ~/git-rectify directory
sudo dpkg -i git_2.7.4-0ubuntu0.4_amd64.deb
Source installation git
Here is just a record of the steps to install git from the source code.
git clone https://github.com/git/git.git
Switch to the corresponding version tag
git checkout -b v2.22.0
sudo apt-get install libssl-dev
Install it according to the installation command described in the doc document.