Subject: Re: Cannot clone the git repository shared over http with authorization.

From: Clemens Buchacher <[email-masked]>
Date: Sun, 1 Apr 2012 21:45:36 +0200

On Sun, Apr 01, 2012 at 08:48:04PM +0200, Artur R. Czechowski wrote:
> 
> arturcz@szczaw:/tmp$ git clone http://blabluga.hell.pl/git/test.git
> Cloning into 'test'...
> error: The requested URL returned error: 401 (curl_result = 22, http_code = 401, sha1 = e884293079beab9f2583b59b4e05479fc84fc588)
> error: Unable to find e884293079beab9f2583b59b4e05479fc84fc588 under http://blabluga.hell.pl/git/test.git
> Cannot obtain needed commit e884293079beab9f2583b59b4e05479fc84fc588
> while processing commit c64bcf957545f61436d405326d985521dc45058f.
> error: Fetch failed.

I've been looking at this a bit. It's probably worth mentioning that the
problem does _not_ happen if username and password are specified in the
URL or in the .netrc. In both of those cases, curl is taking care of the
credentials itself.

So far I figured out that setting 'git config http.maxRequests 1' fixes
the problem as well. Looking at the output with GIT_CURL_VERBOSE=1 set,
it seems that some GET requests use the credentials, while others do
not. My guess is that the CURLOPT_USERPWD option does not apply to all
threads.

Clemens