[root@192 ~]# git --version #查看Git版本
git version 2.9.5
[root@192 ~]# cat /etc/redhat-release #查看系統版本
CentOS Linux release 7.7.1908 (Core)
[root@192 ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc gcc perl-ExtUtils-MakeMaker #安裝依賴
Complete!
[root@192 ~]# yum remove git #卸載舊版本
Complete!
[root@192 ~]# cd /usr/local/src
[root@192 src]# wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.24.0.tar.xz
2019-11-09 03:10:23 (11.6 KB/s) - ‘git-2.24.0.tar.xz’ saved [5766056/5766056]
[root@192 src]# tar -xvf git-2.24.0.tar.xz -C /usr/local
[root@192 src]# cd ../git-2.24.0
[root@192 git-2.24.0]# make prefix=/usr/local/git all
[root@192 git-2.24.0]# make prefix=/usr/local/git install
[root@192 git-2.24.0]# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
[root@192 git-2.24.0]# source /etc/profile
[root@192 git-2.24.0]# git --version
git version 2.24.0
#配置非root用戶使用Git
[gjp@192 ~]$ echo "export PATH=$PATH:/usr/local/git/bin" >> ~/.bashrc
[gjp@192 ~]$ source ~/.bashrc