Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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?

like image 906
Chris Muench Avatar asked Dec 17 '22 16:12

Chris Muench


1 Answers

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

like image 100
tver3305 Avatar answered Dec 19 '22 08:12

tver3305