一般linux自带git版本很旧,会有一定问题,可以先卸载系统自带git:

yum remove git
下载及安装git:

wget https://github.com/git/git/archive/v2.2.1.tar.gz
tar zxvf v2.2.1.tar.gz
cd git-2.2.1
make configure
./configure --prefix=/usr/local/git/ --with-iconv=/usr/local/libiconv --with-curl=/home/{username}/curl/
make
make install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
source /etc/bashrc
配置curl很重要。 
可能出现的问题,少一些系统库: 
1.编译git时报错: zlib.h: No such file or directory
缺少 zlib的头文件, 开发包没装,

yum install zlib (系统默认已经装上)
yum install zlib-devel
解决

2.提示make cc Command not found

yum install gcc
3.make[1]: * [perl.mak] Error 2 make: * [perl/perl.mak] Error 2
执行:

yum install perl-ExtUtils-MakeMaker package.
进行安装 
出现错误二: 
/bin/sh: msgfmt: command not found

yum install gettext-devel
可解决!

4./bin/sh: line 1: asciidoc: command not found
安装asciidoc: 
到官网下载asciidoc 
http://www.methods.co.nz/asciidoc/index.html 
http://sourceforge.net/projects/asciidoc/

cp asciidoc-8.5.2.tar.gz /root/src
cd /root/src
tar xvfz asciidoc-8.5.2.tar.gz
cd asciidoc-8.5.2
./configure
sudo make install
5./bin/sh: line 1: xmlto: command not found

yum install xmlto
6.如果出现http/https异常,安装curl

博客中所涉及到的图片都有版权,请谨慎使用