linux 安装git

一、获取GIT源码

       在 https://github.com/git/git/tree/master 下载自己需要的源码

wget https://github.com/git/git/archive/master.zip

二、安装依赖

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

三、解压、编译、安装

#解压源码包
unzip -zxvf master.zip

#进入解压目录
cd git-master

#编译
make prefix=/usr/local/git all

#安装到目录 /usr/local/git
make prefix=/usr/local/git install

#修改配置
#修改/etc/profile文件,在最后一行加上配置信息
export PATH=/usr/local/git/bin:$PATH

#使用source命令配置立即生效
source /etc/profile

四、查看版本

git --version
原文地址:https://www.cnblogs.com/bmw320li/p/10191349.html