centos下git clone失败处理方法

$ git clone https://code.csdn.net/***/***.git

Initialized empty Git repository in /home/****/****/***/.git/
error: The requested URL returned error: 401 Unauthorized while accessing https://code.csdn.net/***/***.git/info/refs



fatal: HTTP request failed


查看git版本

git version 1.7.1


在网上搜索原因,有人提到更新git版本解决问题。

1. rpm增加rpmforge源
sudo rpm -i http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
可以在 http://pkgs.repoforge.org/rpmforge-release上查看匹配你服务器的对应源
2. 安装证书
sudo rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
3. 更新rpmforge源
 sudo yum --enablerepo=rpmforge-extras update
4. 查询可用git版本
yum --enablerepo=rpmforge-extras provides git
已加载插件:security
git-1.7.1-3.el6_4.1.x86_64 : Fast Version Control System
Repo        : base
匹配来自于:
git-1.7.8.2-2.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
匹配来自于:
git-1.7.9.6-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
匹配来自于:
git-1.7.3.4-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
匹配来自于:
git-1.7.6.1-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
匹配来自于:
git-1.7.10-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
匹配来自于:
git-1.7.11.1-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
匹配来自于:
git-1.7.10.4-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
匹配来自于:
git-1.7.6.4-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
匹配来自于:
git-1.7.6-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
匹配来自于:
git-1.7.11.3-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
匹配来自于:
git-1.7.12.4-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
匹配来自于:
git-1.7.10.1-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
匹配来自于:
git-1.7.7.4-2.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
匹配来自于:
git-1.7.1-3.el6_4.1.x86_64 : Fast Version Control System
Repo        : installed
匹配来自于:
Other       : 提供依赖满足:git
5. 安装git
sudo yum --enablerepo=rpmforge-extras install git-1.7.12.4-1.el6.rfx.x86_64

查看git 版本

$ git --version
git version 1.7.12.4

git升级后,问题解决。


你可能感兴趣的:(服务器)