centos7安装git

https://mirrors.edge.kernel.org/pub/software/scm/git/中找自己需要的版本gz包,复制资源链接地址

下载

wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.25.0.tar.gz

解压

tar -zxf git-2.9.5.tar.gz

编译和安装

进入文件夹  cd git-2.9.5/

安装c编译器 yum -y install gcc

安装autoconf  yum -y install autoconf

安装 yum -y install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker

配置目录:   ./configure --prefix=/usr/local/software/git

执行    make profix=/usr/local/software/git

执行    make install 进行安装

配置环境变量:  

vim /etc/profile

添加

#set git environment
export PATH=$PATH:/usr/local/software/git/bin

让环境生效   source /etc/profile

用  git --version     检查

git

相关推荐