git2.8.2编译安装

分类:技术文档 - Git | 阅读(3412) | 发布于:2016-05-05 10:42

yum默认安装的git版本为1.7.2,这个版本比较老了。只能手动编译安装最新版本。
(1) 添加rpmforge源
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt       
rpm -i rpmforge-release-0.5.3-1.el6.rf.i686.rpm
(2) 安装依赖的包
yum update
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.8.2.tar.gz
tar -zxvf git-2.8.2.tar.gz
cd git-2.8.2
(4) 编译安装
make prefix=/usr/local/git all
make prefix=/usr/local/git install
(5) 将git安装路径添加到PATH变量
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 "user@mail.com"

标签:git