centos 7 安装 git 2.22.0

时间:2021-04-02 10:13:45

1、安装所需软件包

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel 
yum install gcc perl-ExtUtils-MakeMaker

2、下载&安装

cd /tmp
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.22.0.tar.gz
tar xzf git-2.22.0.tar.gz
cd git-2.22.0
make prefix=/usr/local/git all
make prefix=/usr/local/git install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
source /etc/bashrc

3、检查版本

git --version

o、其他
centos 7.x版本自带git 1.8,安装新版本之前需要使用yun remove git卸载(安装后卸载也可以)。