0)安裝依賴軟件
[root@uatjenkins01 ~] # yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
[root@uatjenkins01 ~] # yum install gcc perl-ExtUtils-MakeMaker
1)卸載系統(tǒng)自帶的底版本git(1.7.1)
[root@uatjenkins01 ~] # git --version
git version 1.7.1
[root@uatjenkins01 ~] # yum remove git
2)編譯安裝最新的git版本
[root@uatjenkins01 ~] # cd /usr/local/src/
[root@uatjenkins01 src] # wget https://www./pub/software/scm/git/git-2.15.1.tar.xz
[root@uatjenkins01 src] # tar -vxf git-2.15.1.tar.xz
[root@uatjenkins01 src] # cd git-2.15.1
[root@uatjenkins01 git-2.15.1] # make prefix=/usr/local/git all
[root@uatjenkins01 git-2.15.1] # make prefix=/usr/local/git install
[root@uatjenkins01 git-2.15.1] # echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
[root@uatjenkins01 git-2.15.1] # source /etc/profile
[root@uatjenkins01 ~] # git --version
git version 2.15.1
======================================================================
如果是非root用戶使用git,,則需要配置下該用戶下的環(huán)境變量
[app@uatjenkins01 ~]$ echo "export PATH=$PATH:/usr/local/git/bin" >> ~/.bashrc
[app@uatjenkins01 ~]$ source ~/.bashrc
[app@uatjenkins01 ~]$ git --version
git version 2.15.1
|