centos6.6安装git2.x

(1) 添加rpmforge源
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
sudo rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
sudo rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

(2) 安装依赖的包
sudo yum update
sudo 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.gz
tar -zxvf git-2.3.0.tar.gz
cd git-2.3.0

(4) 编译安装
make configure
./configure --prefix=/usr/local/git --with-iconv=/usr/local/libiconv
make all doc
make install install-doc install-html


(5) 将git安装路径添加到PATH变量
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
source /etc/profile
或者sudo vim /etc/bashrc
在最后一行添加 export PATH=/usr/local/git/bin:$PATH 保存退出

(6) 验证是否安装成功
source /etc/bashrc
git --version

(7) 配置git
git config --global user.name "username"
git config --global user.email "[email protected]"



你可能感兴趣的:(centos6.6安装git2.x)