【centos6.6环境搭建】git升级
发布于 1 年前 作者 qjzd 522 次浏览 来自 码农

centos6.6的版本过低

centos6.6默认的git版本是1.7.1。 在克隆项目的时候回报错

git clone http://xxxxx.git
error: The requested URL returned error: 401 Unauthorized while accessing http://x.git/info/refs
fatal: HTTP request failed

安装依赖

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
yum install  gcc perl-ExtUtils-MakeMaker   
yum install autoconf

卸载老版本

默认centos系统下git是没有被安装的,如果已经装过,请卸载

yum remove git 

下载安装新版git

wget https://github.com/git/git/archive/v2.2.1.tar.gz
tar zxvf v2.2.1.tar.gz
cd git-2.2.1
make configure
./configure --prefix=/usr/local/git --with-iconv=/usr/local/libiconv
make install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
source /etc/bashrc

安装文档

yum install xmlto
make all doc 
make install install-doc install-html

查看版本

git --version
git version 2.2.1

尝试clone项目

git clone git@xxxx.git

finish

参考链接

https://segmentfault.com/a/1190000004563172

回到顶部