### 1. 下载git wget --no-check-certificate https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.30.1.tar.gz ### 2. 解压 tar -zxvf git-2.30.1.tar.gz ### 3. 进入文件夹 cd git-2.30.1 ### 4. 安装所需依赖 yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker > 没有gcc的话需要安装gcc > > yum install gcc curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker ### 5.编译 make prefix=/usr/local/git all ### 6.安装 make prefix=/usr/local/git install ### 7.修改环境变量 vi /etc/profile 最下面加上: export PATH=$PATH:/usr/local/git/bin 刷新环境变量 source /etc/profile ### 8. 检查 git --version