Chris Muench
Chris Muench

Reputation: 18318

GIT clone over http fails (curl result = 22, http_code 401)

Mac OS X 10.6.6 Server git version for both client and server is: 1.7.3.5

Error returned is:

Chris-Muenchs-Mac-Book-Pro:Desktop cmuench$ git clone http://example.com/is.git
Cloning into is...
Username: 
Password: 
error: The requested URL returned error: 401 (curl_result = 22, http_code = 401, sha1 = 8fbb19449c4388ae4b51594af3507bfd44c567d7)
error: Unable to find 8fbb19449c4388ae4b51594af3507bfd44c567d7 under http://example.com/is.git
Cannot obtain needed commit 8fbb19449c4388ae4b51594af3507bfd44c567d7
while processing commit 129e0ba31589356b9c4326907ddf7e11d7b6be18.
error: Fetch failed.

The above referenced commit sha1 exists in the repo and I am able to clone via the file system, but not over http or https.

Here is my apache settings: (WebDav is ON) (Defined above this snippet)

<Location "/is.git">
    AuthType Basic
    <Limit GET HEAD OPTIONS CONNECT POST PROPFIND PUT DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
        Require group  development
    </Limit>
    AuthName "is.git"
</Location>

Any ideas on how to fix this?

Upvotes: 4

Views: 7925

Answers (2)

nickgrim
nickgrim

Reputation: 5437

The HTTP 403 you're seeing when you attempt to push is the code meaning "Forbidden". Do you need to add:

Order allow,deny
Allow from all

...to your Location block?

Upvotes: 0

tver3305
tver3305

Reputation: 8594

Overview

The HTTP 401 means that the request requires user authentication, refer to HTTP Status Codes.

Assuming that you entered the correct username and password, the 401 response means that maybe the credentials are not being submitted correctly or maybe the credentials are not being authenticated well. Ignore this line.

Real Problem

The next 3 lines however indicate where the real issue lies.

     error: Unable to find 8fbb19449c4388ae4b51594af3507bfd44c567d7 under http://example.com/is.git
     Cannot obtain needed commit 8fbb19449c4388ae4b51594af3507bfd44c567d7
     while processing commit 129e0ba31589356b9c4326907ddf7e11d7b6be18.

These implies that some commits cannot be found on the server.

Remedy

Doing a git cleanup git gc should fix the problem. Run git gc on the folder where the git repo is hosted and that should fix the problem.

Cheers

Upvotes: 12

Related Questions