以Centos6.5为例,通常系统会默认自带git,版本为1.7.1,不够友好,所以首要任务就是卸载git

1
yum git

安装

1
2
3
4
5
6
7
8
9
yum install -y epel-release
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
yum install gcc perl-ExtUtils-MakeMaker
cd usr/local/src
wget https://www.kernel.org/pub/software/scm/git/git-2.0.5.tar.gz
tar -zxvf git-2.0.5.tar.g; cd git-2.0.5
./configure –prefix=/usr/local/git
make
make install

测试结果

1
/usr/local/git/bin/git –version

显示为 git version 2.0.5 则安装成功!!!后续自己手动修改环境变量就OK了!

Mac

MAC一般自带2.5.4不需要重新安装