引言
CentOS 7上git clone总是报错,如:
[vagrant@localhost ~]$ git clone --verbose http://github.com/danielflower/app-runner.git
Cloning into 'app-runner'...
fatal: unable to access 'http://github.com/danielflower/app-runner.git/': TCP connection reset by peer
解决方法:通过yum install的git版本太旧,升级git版本后解决了该问题。
CentOS版本:?CentOS Linux release 7.9.2009 (Core)
git旧版本:1.8.3.1
git新版本:2.28.0
卸载老版本git
sudo yum remove git
安装新版本git
1. 安装依赖
sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc -y
sudo yum install gcc perl-ExtUtils-MakeMaker -y
2. 下载git安装包
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.28.0.tar.gz
注:如果没有wget,先yum install wget
3. 解压安装
tar -zxf git-2.28.0.tar.gz
cd git-2.28.0/
sudo make prefix=/usr/local/git all
sudo make prefix=/usr/local/git install
4. 配置环境变量
echo "export PATH=$PATH:/usr/local/git/bin" >> ~/.bashrc
source ~/.bashrc
?5. git clone正常了
[vagrant@localhost ~]$ git clone https://github.com/danielflower/app-runner-home.git
Cloning into 'app-runner-home'...
remote: Enumerating objects: 577, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 577 (delta 7), reused 0 (delta 0), pack-reused 563
Receiving objects: 100% (577/577), 73.06 KiB | 326.00 KiB/s, done.
Resolving deltas: 100% (218/218), done.
参考
git pull错误:TCP connection reset by peer | JakeLin's Blog
|