1 最新git源碼下載地址:
https://github.com/git/git/releases
https://www.kernel.org/pub/software/scm/git/
可以手動下載下來在上傳到服務(wù)器上面
2 移除舊版本git
centos自帶Git肮帐,7.x版本自帶git 1.8.3.1(應(yīng)該是想括,也可能不是)医咨,
安裝新版本之前需要使用yun remove git卸載(安裝后卸載也可以)勃教。
[root@Git ~]# git --version ## 查看自帶的版本
git version 1.8.3.1
[root@Git ~]# yum remove git ## 移除原來的版本
3 安裝所需軟件包
[root@Git ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
[root@Git ~]# yum install gcc-c++ perl-ExtUtils-MakeMaker
4 下載&安裝
[root@Git ~]# cd /usr/src
[root@Git ~]# wget https://www.kernel.org/pub/software/scm/git/git-2.7.3.tar.gz
5 解壓
[root@Git ~]# tar xf git-2.7.3.tar.gz
6 配置編譯安裝
[root@Git ~]# cd git-2.7.3
[root@Git ~]# make configure
[root@Git ~]# ./configure --prefix=/usr/local/git ##配置目錄
[root@Git ~]# make profix=/usr/local/git
[root@Git ~]# make install
7 加入環(huán)境變量
[root@Git ~]# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
[root@Git ~]# source /etc/profile
8 檢查版本
[root@Git git-2.7.3]# git --version
git version 2.7.3