CentOS安装最新Git

1.依赖库安装

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
yum install  gcc perl-ExtUtils-MakeMaker

2.卸载低版本的 Git

yum remove git

3.下载新版的 Git 源码包

直接到GitHub取最新版,现在的最新版是v2.19.1

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

4.解压到当前目录

tar xzf v2.19.1.tar.gz

5.安装 Git

cd git-2.19.1
make prefix=/usr/local/git all
make prefix=/usr/local/git install

6.添加到环境变量

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

7.查看版本号

git --version
posted @ 2018-11-11 20:26  爱幻想の宅  阅读(160)  评论(0编辑  收藏  举报