- 先卸载旧的git
yum remove git
- 安装依赖包
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
yum install gcc perl-ExtUtils-MakeMaker
- 下载并解压(当前版本2.9.4)
cd /usr/src
wget https://www.kernel.org/pub/software/scm/git/git-2.9.4.tar.gz
tar -zxvf git-2.9.4.tar.gz
- 编译安装设置环境变量
cd git-2.9.4
make prefix=/usr/local/git all
make prefix=/usr/local/git install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
source /etc/bashrc
- 检查版本
git --version
网友评论