一、准备
下载Git包
wget https://github.com/git/git/archive/v2.17.0.tar.gz
二、安装步骤
①创建目录/usr/local/git 并将下载好的tar包解压至该目录 tar –zxvf v2.17.0.tar.gz
②安装依赖yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
③执行git --version
如果之前已有git,就卸载掉 yum remove git
④进入解压后的文件夹 cd git-2.17.0 ,执行编译和安装命令
make prefix=/usr/local/git all
make prefix=/usr/local/git install
⑤配置Git环境变量 vi /etc/profile
#GIT GIT=/usr/local/git PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$MAVEN_HOME/bin:$ROCKETMQ/bin:$GIT/bin export JAVA_HOME JRE_HOME CLASS_PATH PATH MAVEN_HOME
⑥执行git --version