源码安装Git
git官网下载最新版本GIT:
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.8.5.tar.gz
1.安装依赖包:
[root@server tmp]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker -y
安装依赖时,yum自动安装了Git,需要卸载旧版本Git,命令为:
yum remove git
2.安装git:
tar -xvf git-2.8.5.tar.gz -C /usr/local
cd /usr/local
mv git-2.8.5 git
cd git
解压并cd到解压目录
# make prefix=/usr/local/git all # make prefix=/usr/local/git install
3.修改环境变量:
[root@server bin]# vim /etc/profile
export PATH=$PATH:/usr/local/git/bin
[root@server bin]# source /etc/profile
4.测试是否安装成功:
[root@server ~]# git --version git version 2.8.5