1、下载安装包并上传
2、进行解压操作
tar -zxvf git-2.31.1.tar.gz -C /opt/program/
3、安装相关依赖
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker -y
4、编译安装到指定路径
指定安装到/usr/local/git此目录中
make prefix=/usr/local/git all
make prefix=/usr/local/git install
5、编辑环境变量
# GIT_HOME
export GIT_HOME=/usr/local/git
export GIT_PATH=${GIT_HOME}/bin
export PATH=${PATH}:${GIT_PATH}
刷新环境变量
source /etc/profile
6、测试
git --version
7、配置username和email
git config --global user.name “gezq0714”
git config --global user.email “ge051799qi@163.com”