错误详情:

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版本(v1.7.1太低了,需要升级)
git --version


解决方法:升级git

(1)安装依赖

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

(2)卸载老版本

yum remove git

(3)依次执行如下命令

百度网盘git-2.2.1.tar.gz下载包地址:
链接:​​​https://pan.baidu.com/s/1mB0Kk7Yf2ORnJktLco2VTA​​ 提取码:c1xa

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

(4)再次查看git版本

git --version