使用 Git 同步时出现gnutls_handshake() failed: Error in the pull function

本文介绍了一种解决使用Git通过HTTPS克隆仓库时遇到的TLS连接错误的方法。该问题通常由于libcurl4-gnutls-dev导致,文章提供了一种通过更换依赖库并重新编译安装Git的方式来解决此问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误提示

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

转载于:https://www.cnblogs.com/crixec/p/7339659.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值