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

spu*_*der 18 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
Run Code Online (Sandbox Code Playgroud)

作为一种解决方法,我尝试创建一个具有空存储库的文件夹,然后将远程设置为公司服务器.我在尝试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)
Run Code Online (Sandbox Code Playgroud)

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)
Run Code Online (Sandbox Code Playgroud)


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
Run Code Online (Sandbox Code Playgroud)

Jus*_*nen 19

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

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

  • 就是这样。cent 基础存储库中的 git 版本要求明确说明用户名。我会将解决方法添加到描述中。 (2认同)