环境为centos7
1、安装环境
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel -y
yum install gcc-c++ perl-ExtUtils-MakeMaker autoconf -y
2、下载git
wget https://github.com/git/git/archive/v2.27.0.tar.gz
3、解压并进入目录
tar -zxvf v2.27.0.tar.gz
cd git-2.27.0/
4、配置
make configure
./configure --prefix=/usr/local/git
5、编译
make prefix=/usr/local/git
6、安装
make install
7、配置环境变量并使环境变量生效
echo 'export PATH=$PATH:/usr/local/git/bin' >> /etc/profile
source /etc/profile
8、查看git是否安装成功
git --version