Centos7下安装git高版本2.31.1

卸载系统自带的底版本git(1.7.1)

# git --version
git version 1.7.1
# yum remove git

编译安装最新的git版本 

//下载
wget https://www.kernel.org/pub/software/scm/git/git-2.31.1.tar.gz
//解压
tar xzf git-2.31.1.tar.gz
//进入源码目录
cd git-2.31.1
//安装工具和依赖
yum install libcurl-devel
yum install expat-devel
yum install openssl-devel
//编译
make prefix=/usr/local/git all
make prefix=/usr/local/git install
//将git路径加入bashrc配置
echo "export PATH=$PATH:/usr/local/git/bin" >>/etc/bashrc
//应用bashrc
source /etc/bashrc

 检查一下版本号

git --version
git version 2.31.1

 

posted @ 2018-02-07 14:41  温柔的风  阅读(2529)  评论(0编辑  收藏  举报