操作系统centos执行
git clone http://xxxxx.git
报错
error: The requested URL returned error: 401 Unauthorized while accessing http://x.git/info/refs
fatal: HTTP request failed
问题根源在于git版本,解决方案:
- 查看centos6 的git版本
$ git --version
git version 1.7.1
- 先安装依赖
$ yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
$ yum install gcc perl-ExtUtils-MakeMaker
- 卸载老版本
$ yum remove 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
- 查看git 版本
$ git --version
git version 2.2.1
网友评论