使用 Git 同步时出现gnutls_handshake() failed: Error in the pull function
错误提示
fatal: unable to access 'https://android.googlesource.com/platform/prebuilts/qemu-kernel/': gnutls_handshake() failed: Error in the pull function. fatal: unable to access
fatal: unable to access 'https://android.googlesource.com/platform/frameworks/opt/net/ethernet/': gnutls_handshake() failed: The TLS connection was non-properly terminated.
原因分析
由系统的 git 默认使用的 libcurl4-gnutls-dev 造成
解决办法
安装编译环境
sudo apt-get update
sudo apt-get install build-essential fakeroot dpkg-dev libcurl4-openssl-dev
sudo apt-get build-dep git
mkdir git-openssl && cd git-openssl
sudo apt-get source git
替换为 libcurl4-openssl-dev
dpkg-source -x git_2.11.0-4.dsc
gksu sed -i 's/libcurl4-gnutls-dev/libcurl4-openssl-dev/g' debian/control
重构.deb
删除 debian/rules 中的TEST=test行
gksu sed -i 's/TEST=test//g' debian/control
重构sudo dpkg-buildpackage -rfakeroot -b
安装sudo dpkg -i ../git_2.11.0-4_amd64.deb