spuder
spuder

Reputation: 18447

git pull gives error: 401 Authorization Required while accessing https://git.foo.com/bar.git

My macbook pro is able to clone/push/pull from the company git server. My cent 6.3 vm gets a 401 error

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

As a work around, I've tried creating a folder, with an empty repository, then setting the remote to the company server. I get the same error when trying a git pull

The remotes are identical between the machines

MacBook Pro (working)

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)

Cent 6.3 (not working)

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)


The git server only allows https. Not git or ssh connections.

Why is the macbook pro able to do a git pull, while the cent os machine can't?


Solution Update 2013-5-15

As jku mentioned, the culprit is the old version of git installed on the cent box. Unfortunately, 1.7.1 is what you get when you run yum install git

The work around is to manually install a newer version of git, or simply add the username to the repo

git clone https://[email protected]/git/torque-setup

Upvotes: 23

Views: 46643

Answers (2)

cao song
cao song

Reputation: 1

I had the same error:

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

To fix it, I did the following:

check git version: 1.7.1
update git

Upvotes: -5

Jussi Kukkonen
Jussi Kukkonen

Reputation: 14587

I would update the git version: 1.7.10 (or thereabouts) had authentication improvements. It's possible that these improvements were only related to proxies though -- I've forgotten the details already.

Speaking of proxies, you could double-check git config: You wouldn't have proxies or anything like that configured on the macbook but not on the cent machine?

Upvotes: 22

Related Questions