使用OpenSSL的git
当我采用 git配置代理 在 Squid父级socks代理 后面通过代理访问Android源代码仓库 为Pixel 4编译LineageOS 20(Android 13) 遇到一个持续报错:
git HTTPS代理访问
googlesource
报错 TLS连接中断platform/external/ppp:
fatal: unable to access 'https://android.googlesource.com/platform/external/ppp/': gnutls_handshake() failed: The TLS connection was non-properly terminated.
platform/external/ppp: sleeping 4.0 seconds before retrying
fatal: unable to access 'https://android.googlesource.com/platform/external/ppp/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
error: Cannot fetch platform/external/rust/crates/ash from https://android.googlesource.com/platform/external/rust/crates/ash
error: Cannot fetch platform/external/ppp from https://android.googlesource.com/platform/external/ppp
这个问题看起来是Ubuntu gnutls_handshake
解决方案的一个问题,需要通过重新编译 git
来解决(也就是采用 libcurl-openssl-dev
替代 gnutls
)
安装编译环境:
安装git编译依赖环境
sudo apt-get install build-essential fakeroot dpkg-dev
修改
/etc/apt/sources.list
将源代码仓库激活(默认没有激活或配置):
配置apt源代码源
deb http://archive.ubuntu.com/ubuntu jammy main universe
deb-src http://archive.ubuntu.com/ubuntu jammy main universe
deb http://archive.ubuntu.com/ubuntu jammy-security main universe
deb-src http://archive.ubuntu.com/ubuntu jammy-security main universe
deb http://archive.ubuntu.com/ubuntu jammy-updates main universe
deb-src http://archive.ubuntu.com/ubuntu jammy-updates main universe
更新仓库索引然后安装
git
源代码:
更新仓库索引然后安装
git
源代码sudo apt update
mkdir ~/git-rectify
cd ~/git-rectify
# 获取git源代码
sudo apt-get source git
# 安装git编译依赖
sudo apt-get build-dep git
安装
libcurl
:
安装 libcurl
sudo apt-get install libcurl4-openssl-dev
进入git源代码目录,修改2个文件,然后重新编译git:
修订配置后重新编译git with openssl
cd git-2.34.1
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
然后进入上级目录安装编译后的deb包:
安装编译后的deb包
cd .. # is in the ~/git-rectify directory
sudo dpkg -i git_2.34.1-1ubuntu1.10_amd64.deb
安装输出信息:
安装编译后的git包输出信息
(Reading database ... 39077 files and directories currently installed.)
Preparing to unpack git_2.34.1-1ubuntu1.10_amd64.deb ...
Unpacking git (1:2.34.1-1ubuntu1.10) over (1:2.34.1-1ubuntu1.10) ...
Setting up git (1:2.34.1-1ubuntu1.10) ...