首先安装所需的依赖包:

1
2
3
4
5
6
7
8
yum install curl
yum install curl-devel
yum install zlib-devel
yum install openssl-devel
yum install perl
yum install cpio
yum install expat-devel
yum install gettext-devel

下载最新的git包:

1
2
3
4
5
6
7
8
wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz
tar xzvf git-latest.tar.gz
cd git-xxxx-xx-xx
autoconf
./configure
make && make install
 
OK 使用 git --version  来查看版本号

同事 centos 6 系列已经有了 git的源了。6以前的参考
http://geekery.altervista.org/dokuwiki/doku.php