安装前准备
删除旧版本:
1 yum remove git
安装依赖:
1 yum install curl-devel expat-devel openssl-devel zlib-devel
下载并安装
1 wget https://github.com/git/git/archive/v2.15.0.tar.gz 2 tar -zxf v2.15.0.tar.gz 3 cd git-2.15.0
1 autoconf #通过configure.ac生成configure 2 ./configure prefix=/usr/local/git/ #生成Makefile,指定安装路径 3 make #编译 4 make install #安装
将git命令添加到bash中
1 vim /etc/profile
在最后一行加入:
1 export PATH=$PATH:/usr/local/git/bin
刷新profile:
1 source /etc/profile