git 源码安装

  1. 从官网获取版本https://git-scm.com/download/linux
cd /usr/local/src/
https://www.kernel.org/pub/software/scm/git/git-2.38.1.tar.gz```

2.  解压 tar
  tar -zxvf  git-2.38.1.tar.gz

3. 3安装编译所需依赖,命令为:

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

4. 安装依赖时,yum自动安装了Git,需要卸载旧版本Git,命令为: 

yum remove git

5.  cd git-2.38.1
make prefix=/usr/local/git all 
make prefix=/usr/local/git install

6. 打开环境变量配置文件,命令 

vim /etc/profile 
在底部加上Git相关配置信息:

export PATH=$PATH:/usr/local/git/bin 

你可能感兴趣的:(git 源码安装)