CentOS 6自带的git版本是1.7,
安装编译环境
安装gcc
#yuminstallgccgcc-c++autoconfmakeautomakewget-y
安装依赖包
#yuminstallperlcurl-develexpat-develgettext-developenssl-develzlib-devel-y #yuminstallcpiotexinfosgml2xmlopenjadeperl-ExtUtils-MakeMaker-y #yuminstallasciidocxmltodocbook2X-y//为了能够添加更多格式的文档(如doc,html,info) #cd/usr/bin//剩下步骤为避免执行makealldocinfo时报:/bin/sh:line1:docbook2x-texi:commandnotfound #lldb2x_docbook2texi -rwxr-xr-x1rootroot376211月122010db2x_docbook2texi #ln-sdb2x_docbook2texidocbook2x-texi #lldb2x_docbook2texidocbook2x-texi -rwxr-xr-x1rootroot376211月122010db2x_docbook2texi lrwxrwxrwx1rootroot171月1512:31docbook2x-texi->db2x_docbook2texi
卸载自带的git
#yumremovegit-t
源码编译git
下载最新版
#cd/data/toots/ #wgethttps://www.kernel.org/pub/software/scm/git/git-2.15.1.tar.xz
解压
#tarzxvfgit-2.15.1.tar.xz #cdgit-2.15.1
编译安装
#makeconfigure #./configure--prefix=/usr/local/git//配置安装路径 #makealldocinfo//编译 #makeinstallinstall-docinstall-htmlinstall-info//安装
#gitclonegit://git.kernel.org/pub/scm/git/git.git
修改环境变量
#echo-e"#git\nexportPATH=/usr/local/git/bin:\$PATH">/etc/profile.d/git.sh #cat/etc/profile.d/git.sh \#git//文件内容 exportPATH=/usr/local/git/bin:$PATH #source/etc/profile
查看是否安装成功
#git--version gitversion2.15.1原文链接:https://www.f2er.com/centos/374880.html