1.查看是否已安装git,如果存在自带的git,则卸载
查看git版本
$ git --version
删除自带git
$ yum remove git
2.安装依赖包
$ yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
$ yum install asciidoc xmlto docbook2x
3.下载git安装包
https://www.git-scm.com/download/
4.将下载好的git-2.17.1.tar.gz上传至服务器,然后解压到opt目录下,最后安装
$ tar -zxvf git-2.17.1.tar.gz -C /opt/
$ cd /opt/git-2.17.1/
$ make configure
$ ./configure --prefix=/usr
$ make all doc info
$ make install install-doc install-html install-info
至此安装完成!!