系统环境:centos6.6
1,安装准备
yum -y install gcc zlib-devel openssl-devel perl cpio expat-devel gettext-devel openssl zlib curl autoconf tk
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
下载最新git: #cd /opt/下
#wget https://www.kernel.org/pub/software/scm/git/git-2.7.0.tar.gz (或者从官网 http://git-scm.com/download ;http://git-core.googlecode.com/files)
#tar zxvf git-2.7.0.tar.gz
#cd git-2.7.0
#make prefix=/opt/git all doc 安装在/opt/git目录
#make prefix=/opt/git install install-doc
#./configure --prefix=/opt/git
#make
#make install
#/opt/git/bin/git --version
git version 2.7.0
为了方便使用,做一个软链接
#ln -s /opt/git/bin/* /usr/bin/ [如果安装在/usr/local下系统环境变量无需要做软链接]
#在系统任意目录下输入:git --version
git version 2.7.0
即安装成功
========================================
方法二 安装目录在/usr/local