1、安装git依赖包
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
2、删除已有的git
yum remove git
4、下载git源码
切换到你的包文件存放目录下
cd /home/lnmp
下载git安装包
wget https://www.kernel.org/pub/software/scm/git/git-2.8.3.tar.gz
解压git安装包
.tar.gz cd git-
配置git安装路径
./configure prefix=/usr/local/git/
编译并且安装
make && make install
5、将git指令添加到bash中
vim /etc/profile
在最后一行加入
export PATH=$PATH:/usr/local/git/bin
让该配置文件立即生效
source /etc/profile
6、到此安装完毕,查看git版本号
git --version
本文转自:
https://www.cnblogs.com/lhbryant/p/6928894.html