centos安装指定版本的git
打开官网查看各个版本的git:https://mirrors.edge.kernel.org/pub/software/scm/git/
下载需要的版本,这里下载的是2.44.2:
# 下载
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.44.2.tar.gz
# 解压
tar -xvzf git-2.44.2.tar.gz
安装一些必要指令
yum install libcurl-devel
yum install openssl-devel
yum install expat-devel
yum install gcc-c++ -y
编译
cd git-2.44.2
mkdir -p /usr/local/git && chmod -R 777 /usr/local/git
# 这个命令很耗时
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
查看版本
git --version