Git源码安装 Linux指定安装目录
1.安装依赖包
$ yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
2.下载最新版源码包https://www.kernel.org/pub/software/scm/git/
$ wget https://www.kernel.org/pub/software/scm/git/git-2.16.1.tar.gz
3.解压源码包,并进入解压目录
$ tar -zxvf git-2.16.1.tar.gz $ cd git-2.16.1
4.指定安装目录为/usr/local/git-2.16.1 并执行安装命令
$ ./configure --prefix=/usr/local/git-2.16.1 && make && make install
5.设置全局环境变量,修改/etc/profile 并使修改生效
$ vi /etc/profile
$ source /etc/profile
6.查看git版本,显示版本号说明安装成功
$ git --version