由于Centos6.5使用yum -y install git 安装的git版本是
git --version
git version 1.7.1
想要升级到2.2.1:
># yum remove 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
># make all doc
># make install install-doc install-html
># echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
># source /etc/bashrc
># git --version
>git version 2.2.1
三、安装中的错误
1、error: MSGFMT po/de.msg make[1]: *** [po/de.msg] Error 127
解决:yum install tk zlib-devel openssl-devel perl cpio expat-devel gettext-devel
2、errro: asciidoc: command not found
解决:yum install -y asciidoc
3、errro:xmlto: command not found
解决:yum install -y xmlto
最后提醒,升级安装git的时候,最好一次安装依赖。
yum install -y tk zlib-devel openssl-devel perl cpio expat-devel gettext-devel asciidoc xmlto
这里执行make all doc时还会报一个错误
usr/bin/perl Makefile.PL PREFIX='/usr/local/git' INSTALL_BASE='' --localedir='/usr/local/git/share/locale'
Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 3.
BEGIN Failed--compilation aborted at Makefile.PL line 3.
make[1]: *** [perl.mak] Error 2
make: *** [perl/perl.mak] Error 2
解决方法:
yum install perl-ExtUtils-MakeMaker package
参考: http://www.centoscn.com/image-text/config/2015/0913/6169.html http://my.oschina.net/indestiny/blog/223082?fromerr=3h9La6Pw