跳到主要内容

CentOS git 升级至2.x

CentOS yum install git 最高只能安装到 git v1.8.3.1,如果需要升级 git 的话就需要编译安装。

步骤

1. 卸载旧版本 git

yum remove git

2. 下载需要的安装包并解压

下载地址为 https://mirrors.edge.kernel.org/pub/software/scm/git/

wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.2.tar.xz
tar -vxf git-2.9.2.tar.xz

3. 编译安装

cd git-2.9.2
make prefix=/usr/local/git all
make prefix=/usr/local/git install
echo "export PATH=$PATH:/usr/local/git/bin">>/etc/profile
source /etc/profile

4. 检查版本

git --version