centos 编译安装git
centos 7.x版本自带git 1.8,安装新版本之前需要使用yum remove git卸载
1、安装依赖
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker glibc-static
2、下载安装包
地址:https://mirrors.edge.kernel.org/pub/software/scm/git/
本次安装:git-2.40.0.tar.gz
3、解压并安装到/usr/local
tar -zxvf git-2.40.0.tar.gz
cd git-2.40.0
./configure --prefix=/usr/local/git
make && make install
4、修改配置文件
vim /etc/profile
export PATH=$PATH:/usr/local/git/bin
source /etc/profile
5、查看版本
/usr/local/git/bin/git --version
因为系统自带有git,为方便使用,创建一个软连接
ln -s /usr/local/git/bin/git /usr/bin
转载请记录来源!!!!
https://www.cnblogs.com/leihongnu/