- 下载源码包(我的版本是git-2.11.0.tar.gz)
wget https://www.kernel.org/pub/software/scm/git/git-2.11.0.tar.gz
- 解压压缩包
# tar -xvf git-2.11.0.tar.gz
- 进入目录
# cd git-2.11.0
- 安装依赖包
# yum -y install curl-devel zlib-devel openssl-devel perl cpio expat-devel gettext-devel perl-ExtUtils-MakeMaker package asciidoc
- 删除旧的版本
# yum remove git
-
编译
# make prefix=/usr/local/git all
安装:
# make prefix=/usr/local/git install
- 定义环境变量
- root
# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
- 普通用户
$ echo "export PATH=$PATH:/usr/local/git/bin" >> ~/.bashrc
- git --version 后面出现如下所示