git pull给出错误:访问https://git.foo.com/bar.git时需要401授权

时间:2013-05-15 18:19:37

标签: git

我的macbook pro能够从公司的git服务器克隆/推/拉。 我的6.3分vm得到401错误

git clone https://git.acme.com/git/torque-setup
"error: The requested URL returned error: 401 Authorization Required while accessing https://git.acme.com/git/torque-setup/info/refs

作为解决方法,我尝试使用空存储库创建文件夹,然后将远程设置为公司服务器。我在尝试git pull时遇到同样的错误

机器之间的遥控器是相同的

MacBook Pro (正常工作)

git --version
git version 1.7.10.2 (Apple Git-33)

git remote -v
origin  https://git.acme.com/git/torque-setup (fetch)
origin  https://git.acme.com/git/torque-setup (push)

分6.3 (不工作)

yum install -y git

git --version
git version 1.7.1

git remote -v
origin  https://git.acme.com/git/torque-setup (fetch)
origin  https://git.acme.com/git/torque-setup (push)


git服务器只允许https。不是git或ssh连接。

为什么macbook pro能够做一个git pull,而cent os机器不能?


解决方案更新2013-5-15

正如jku所说,罪魁祸首是安装在分箱上的旧版git。不幸的是,1.7.1是你运行yum install git

时得到的

解决方法是手动安装较新版本的git,或者只是将用户名添加到repo

git clone https://joe@git.acme.com/git/torque-setup

2 个答案:

答案 0 :(得分:19)

我会更新git版本:1.7.10(或其附近)有身份验证改进。这些改进可能只与代理相关 - 我已经忘记了细节。

说到代理,你可以仔细检查一下git config:你不会在macbook上配置代理或类似配置而不在分机上配置吗?

答案 1 :(得分:-4)

我有同样的错误:

error: The requested URL returned error: 401 while accessing 
fatal: HTTP request failed

为了解决这个问题,我做了以下几点:

check git version: 1.7.1
update git