CentOS 6.8 自带的 Git 版本为 1.7.1,比较旧,yum 安装也停留在 1.7.1,还是源码编译安装吧。
1. 下载源码:
wget -c https://github.com/git/git/archive/v2.12.1.tar.gz
2. 卸载老版本Git
yum remove git
3. 解压、编译、安装
tar zxvf v2.12.1.tar.gz cd git-2.12.1 make configure ./configure --prefix=/usr/local/git --with-iconv=/usr/local/libiconv make all doc sudo make install install-doc install-html
4. 建立软链接(注意:一定要把 /usr/local/git/bin 目录下的所有文件都做个 软连接 !)
ln -s /usr/local/git/bin/git /usr/local/bin/git ln -s /usr/local/git/bin/git-cvsserver /usr/local/bin/git-cvsserver ln -s /usr/local/git/bin/gitk /usr/local/bin/gitk ln -s /usr/local/git/bin/git-receive-pack /usr/local/bin/git-receive-pack ln -s /usr/local/git/bin/git-shell /usr/local/bin/git-shell ln -s /usr/local/git/bin/git-upload-archive /usr/local/bin/git-upload-archive ln -s /usr/local/git/bin/git-upload-pack /usr/local/bin/git-upload-pack
5. 查看是否安装成功
git version
相关文章: