centos7.4安装git-v2.15.0

1、查看已有git版本

git --version

2、卸载低版本git

sudo yum remove git

3、依赖库安装

sudo yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel

sudo yum -y install  gcc perl-ExtUtils-MakeMaker

4、下载最新版git

sudo wget https://github.com/git/git/archive/v2.15.0.tar.gz

5、解压到相应的目录

tar zxf git-2.15.0.tar.gz ..

6、安装git

cd git-2.15.0

sudo make prefix=/usr/local/git all

sudo make prefix=/usr/local/git install

7、添加到系统环境变量

sudo echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc

sudo source /etc/bashrc

8、添加到用户环境变量

echo "export PATH=$PATH:/usr/local/git/bin" >> /home/test/.bash_profile

source /home/test/.bash_profile

9、查看版本号

git --version

#git version 2.15.0

你可能感兴趣的:(centos7.4安装git-v2.15.0)