1.安装git依赖包
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
2.删除已有的git
yum remove git
3.下载git源码
cd /usr/local/tools/
wget https://www.kernel.org/pub/software/scm/git/git-2.8.3.tar.gz
解压安装包
tar -zxvf git-2.8.3.tar.gz
cd git-2.8.3/
配置git安装路径
./configure prefix=/usr/local/git/
编译并且安装
make && make install
查看git版本号
git --version
4.将git指令添加到bash中
vi /etc/profile
并在最后一行加入
export PATH=$PATH:/usr/local/git/bin
让该配置文件立即生效
source /etc/profile
网友评论