1.准备工作(安装所需软件包)
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
yum install gcc perl-ExtUtils-MakeMaker
2.检查默认版本git
centos7.x中默认git版本为1.8.3.1,所以在安装之前先卸载默认版本git,
卸载命令 yun remove git
3.下载安装
git官网安装包下载地址 https://mirrors.edge.kernel.org/pub/software/scm/git/
cd /usr/src
wget https://www.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
tar -zxvf git-2.9.5.tar.gz
cd git-2.9.5
make prefix=/usr/local/git all
make prefix=/usr/local/git install
# 创建软连接
cd /usr/bin
ln -s /usr/local/git/bin/git git
4.完成
git --version 查看