1、安装编译 git 时需要的包
yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel
yum install -y gcc perl-ExtUtils-MakeMaker
2、删除已有的 git
yum remove git
3、Git 官网下载 Git 最新版 tar 包,地址
wget安装:
yum install wget -y
cd /home/
wget https://github.com/git/git/archive/refs/tags/v2.39.2.tar.gz
4、编译安装
cd /home/
tar -zxvf v2.39.2.tar.gz -C /usr/local/src/
cd /usr/local/src/
- 进行编译
make prefix=/usr/local/git all
make prefix=/usr/local/git install
5、配置环境变量
vim /etc/profile
在配置末尾处加入
# git
export GIT_HOME=/usr/local/git
export PATH=$PATH:${GIT_HOME}/bin
标签:git,tar,05,devel,centos7,yum,usr,local
From: https://www.cnblogs.com/bigron/p/17487502.html