(1) 添加rpmforge源wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpmsudo rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txtsudo rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm(2) 安装依赖的包sudo yum updatesudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker(3) 下载git源码并解压缩wget https://www.kernel.org/pub/software/scm/git/git-2.3.0.tar.gztar -zxvf git-2.3.0.tar.gzcd git-2.3.0(4) 编译安装make configure./configure --prefix=/usr/local/git --with-iconv=/usr/local/libiconvmake all docmake install install-doc install-html(5) 将git安装路径添加到PATH变量echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profilesource /etc/profile或者sudo vim /etc/bashrc在最后一行添加 export PATH=/usr/local/git/bin:$PATH 保存退出(6) 验证是否安装成功source /etc/bashrcgit --version(7) 配置gitgit config --global user.name "username"git config --global user.email "user@mail.com"