一、 卸载老版本git1.7.1
- yum remove git
二、 安装编译git源码所需要的工具
- yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
- yum install gcc perl-ExtUtils-MakeMaker
- yum install xmlto
三、下载git源码
- wget -o git-2.2.1.tar.gz https://github.com/git/git/archive/v2.2.1.tar.gz
- tar xf git-2.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版本
- git --version