一、使用yum进行安装
yum install git
因为版本要求,我们一般不用上面的方法,而是下载git源码编译安装
二、安装包安装
1.下载
1.下载地址:Tags · git/git · GitHub,最新版本为2.38.0:
2.用wegt命令进行下载:wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.31.1.tar.gz --no-check-certificate
2.安装
cd /home/git-2.19.2
yum -y install gcc
yum -y install autoconf
yum install tk zlib-devel openssl-devel perl cpio expat-devel gettext-devel
make configure
./configure --prefix=/home/git
make profix=/home/git
make install
echo "export PATH=$PATH:/home/git/bin" >> /etc/profile
source /etc/profile
3.验证
git --version