{"thread":{"id":"45820","subject":"push fails with return code 22","startedAt":"2017-04-27T18:37:25Z","lastAt":"2017-04-28T15:48:22Z","messageCount":7,"participants":["Andrew Watson","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"318083","messageId":"CAH6sfJUn99ezs-uZuYVj15qOeMv79ji7r0Ldvoreef0z3LzG8Q@mail.gmail.com","threadId":"45820","inReplyTo":null,"subject":"push fails with return code 22","fromName":"Andrew Watson","fromEmail":"andwatsresearch@gmail.com","sentAt":"2017-04-27T18:37:19Z","receivedAt":"2017-04-27T18:37:25Z","isPatch":false,"sender":{"key":"andwatsresearch@gmail.com","avatar":null},"body":"Hi,\n\nI'm trying to setup git with Smart HTTP so we can move off of SVN.\n\nI've used the blog post: https://git-scm.com/blog/2010/03/04/smart-http.html\n\nI'm getting \"error: Cannot access URL ... return code 22\" when I try\nto push. Clone works fine.\n\nI verified authentication by replacing my LDAP stuff, which looks to\nwork according to Apache logs, with Require all granted.\n\nDone a lot of googling and posted on stackoverflow at this point.\n\nMy system is CentOS 7 which reports git version 1.8.3.1 and Apache\n2.4.6. I also tried on Ubuntu 16.04 with git 2.7.4 and Apache 2.4.18.\n\nUsing GIT_CURL_VERBOSE I can see it fail after a PROPFIND.\n\nMy stackoverflow post with all the debug info I could think of is\nhere: http://stackoverflow.com/questions/43643152/git-push-results-in-return-code-22\n\nI'll re-post whatever is requested here if needed.\n\nReally hoping to get this working.\n"},{"id":"318087","messageId":"20170427201804.3abt5ht6dkwwqo4r@sigill.intra.peff.net","threadId":"45820","inReplyTo":"CAH6sfJUn99ezs-uZuYVj15qOeMv79ji7r0Ldvoreef0z3LzG8Q@mail.gmail.com","subject":"Re: push fails with return code 22","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-04-27T20:18:04Z","receivedAt":"2017-04-27T20:18:16Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Apr 27, 2017 at 02:37:19PM -0400, Andrew Watson wrote:\n\n> I'm trying to setup git with Smart HTTP so we can move off of SVN.\n> \n> I've used the blog post: https://git-scm.com/blog/2010/03/04/smart-http.html\n\nI'm not sure how that post will have aged. You might check your setup\nagainst the documentation in \"git help http-backend\", which is kept more\nup to date.\n\n> My system is CentOS 7 which reports git version 1.8.3.1 and Apache\n> 2.4.6. I also tried on Ubuntu 16.04 with git 2.7.4 and Apache 2.4.18.\n> \n> Using GIT_CURL_VERBOSE I can see it fail after a PROPFIND.\n\nThat means the client isn't using smart-http. PROPFIND is part of the\n\"dumb\" http push-over-webdav.\n\nSo the problem is likely in the very first request Git makes to\n/info/refs/?service=git-receive-pack. The response there is what the\nclient uses to decide whether the server understands smart-http or not.\n\n> My stackoverflow post with all the debug info I could think of is\n> here: http://stackoverflow.com/questions/43643152/git-push-results-in-return-code-22\n\nI notice the response for that first request has:\n\n  Content-Length: 0\n  Content-Type: text/plain; charset=UTF-8\n\nwhich implies to me that the git-http-backend CGI isn't being run.\n\n-Peff\n"},{"id":"318181","messageId":"CAH6sfJX338f=WyEbCBXX_bzq=homhMs=cjPtzmH9cSvtBKPnaw@mail.gmail.com","threadId":"45820","inReplyTo":"20170427201804.3abt5ht6dkwwqo4r@sigill.intra.peff.net","subject":"Re: push fails with return code 22","fromName":"Andrew Watson","fromEmail":"andwatsresearch@gmail.com","sentAt":"2017-04-28T15:09:55Z","receivedAt":"2017-04-28T15:10:07Z","isPatch":false,"sender":{"key":"andwatsresearch@gmail.com","avatar":null},"body":"Hi Peff,\n\nI agree that it does look like the client isn't using smart-http. I am\nusing the Windows client from git-scm.com.\n\nThanks for pointing me to git help http-backend. I confirmed the\nmodules are loaded and the CGI environment variables. I've added\n\"AcceptPathInfo On\" to my httpd.conf just to be safe.\n\nI'm not sure what /info/refs is supposed to look like, but it is\nempty. Could that be the issue?\n\nDo you see anything in my apache configuration that looks wrong?\n\nAndrew\n\nOn Thu, Apr 27, 2017 at 4:18 PM, Jeff King <peff@peff.net> wrote:\n> On Thu, Apr 27, 2017 at 02:37:19PM -0400, Andrew Watson wrote:\n>\n>> I'm trying to setup git with Smart HTTP so we can move off of SVN.\n>>\n>> I've used the blog post: https://git-scm.com/blog/2010/03/04/smart-http.html\n>\n> I'm not sure how that post will have aged. You might check your setup\n> against the documentation in \"git help http-backend\", which is kept more\n> up to date.\n>\n>> My system is CentOS 7 which reports git version 1.8.3.1 and Apache\n>> 2.4.6. I also tried on Ubuntu 16.04 with git 2.7.4 and Apache 2.4.18.\n>>\n>> Using GIT_CURL_VERBOSE I can see it fail after a PROPFIND.\n>\n> That means the client isn't using smart-http. PROPFIND is part of the\n> \"dumb\" http push-over-webdav.\n>\n> So the problem is likely in the very first request Git makes to\n> /info/refs/?service=git-receive-pack. The response there is what the\n> client uses to decide whether the server understands smart-http or not.\n>\n>> My stackoverflow post with all the debug info I could think of is\n>> here: http://stackoverflow.com/questions/43643152/git-push-results-in-return-code-22\n>\n> I notice the response for that first request has:\n>\n>   Content-Length: 0\n>   Content-Type: text/plain; charset=UTF-8\n>\n> which implies to me that the git-http-backend CGI isn't being run.\n>\n> -Peff\n"},{"id":"318185","messageId":"20170428152025.7lgkirbhpsccupt3@sigill.intra.peff.net","threadId":"45820","inReplyTo":"CAH6sfJX338f=WyEbCBXX_bzq=homhMs=cjPtzmH9cSvtBKPnaw@mail.gmail.com","subject":"Re: push fails with return code 22","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-04-28T15:20:25Z","receivedAt":"2017-04-28T15:20:35Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Apr 28, 2017 at 11:09:55AM -0400, Andrew Watson wrote:\n\n> Thanks for pointing me to git help http-backend. I confirmed the\n> modules are loaded and the CGI environment variables. I've added\n> \"AcceptPathInfo On\" to my httpd.conf just to be safe.\n> \n> I'm not sure what /info/refs is supposed to look like, but it is\n> empty. Could that be the issue?\n\nNo, that shouldn't matter. The on-disk file is used only for dumb-http\nrequests. In a working smart-http system, the info/refs request should\ngo to the CGI, which will generate the ref advertisement dynamically.\n\n> Do you see anything in my apache configuration that looks wrong?\n\nIt looks reasonable to me, but I'm far from an expert on Apache config.\n\nWhen you clone, is it using smart-http there? Try using GIT_CURL_VERBOSE\nto see what the response is to the initial /info/refs fetch when you\nclone.\n\n-Peff\n"},{"id":"318186","messageId":"CAH6sfJUoCPVJz47U8wA306hkCo_Z+gv5s0XHjtkGH6fj8-hUZQ@mail.gmail.com","threadId":"45820","inReplyTo":"20170428152025.7lgkirbhpsccupt3@sigill.intra.peff.net","subject":"Re: push fails with return code 22","fromName":"Andrew Watson","fromEmail":"andwatsresearch@gmail.com","sentAt":"2017-04-28T15:28:14Z","receivedAt":"2017-04-28T15:28:22Z","isPatch":false,"sender":{"key":"andwatsresearch@gmail.com","avatar":null},"body":"Hi Peff,\n\nThanks for the help.\n\n$ GIT_CURL_VERBOSE=1 git clone http://git.site.domain.com/foo/gitrepo.git\nCloning into 'gitrepo'...\n* Couldn't find host git.site.domain.com in the _netrc file; using defaults\n* timeout on name lookup is not supported\n*   Trying 192.168.16.138...\n* TCP_NODELAY set\n* Connected to git.site.domain.com (192.168.16.138) port 80 (#0)\n> GET /foo/gitrepo.git/info/refs?service=git-upload-pack HTTP/1.1\nHost: git.site.domain.com\nUser-Agent: git/2.12.2.windows.2\nAccept: */*\nAccept-Encoding: gzip\nPragma: no-cache\n\n< HTTP/1.1 200 OK\n< Date: Fri, 28 Apr 2017 15:25:02 GMT\n< Server: Apache/2.4.6 (CentOS) PHP/5.4.16\n< Last-Modified: Tue, 25 Apr 2017 18:11:35 GMT\n< ETag: \"0-54e01a77ac500\"\n< Accept-Ranges: bytes\n< Content-Length: 0\n< Content-Type: text/plain; charset=UTF-8\n<\n* Connection #0 to host git.site.domain.com left intact\n* Couldn't find host git.site.domain.com in the _netrc file; using defaults\n* Found bundle for host git.site.domain.com: 0x1cc9fc0 [can pipeline]\n* Re-using existing connection! (#0) with host git.site.domain.com\n* Connected to git.site.domain.com (192.168.16.138) port 80 (#0)\n> GET /foo/gitrepo.git/HEAD HTTP/1.1\nHost: git.site.domain.com\nUser-Agent: git/2.12.2.windows.2\nAccept: */*\nAccept-Encoding: gzip\nPragma: no-cache\n\n< HTTP/1.1 200 OK\n< Date: Fri, 28 Apr 2017 15:25:02 GMT\n< Server: Apache/2.4.6 (CentOS) PHP/5.4.16\n< Last-Modified: Mon, 24 Apr 2017 20:51:42 GMT\n< ETag: \"17-54defc6469818\"\n< Accept-Ranges: bytes\n< Content-Length: 23\n<\n* Connection #0 to host git.site.domain.com left intact\nwarning: You appear to have cloned an empty repository.\n\nContent length is again 0.\n\nOn Fri, Apr 28, 2017 at 11:20 AM, Jeff King <peff@peff.net> wrote:\n> On Fri, Apr 28, 2017 at 11:09:55AM -0400, Andrew Watson wrote:\n>\n>> Thanks for pointing me to git help http-backend. I confirmed the\n>> modules are loaded and the CGI environment variables. I've added\n>> \"AcceptPathInfo On\" to my httpd.conf just to be safe.\n>>\n>> I'm not sure what /info/refs is supposed to look like, but it is\n>> empty. Could that be the issue?\n>\n> No, that shouldn't matter. The on-disk file is used only for dumb-http\n> requests. In a working smart-http system, the info/refs request should\n> go to the CGI, which will generate the ref advertisement dynamically.\n>\n>> Do you see anything in my apache configuration that looks wrong?\n>\n> It looks reasonable to me, but I'm far from an expert on Apache config.\n>\n> When you clone, is it using smart-http there? Try using GIT_CURL_VERBOSE\n> to see what the response is to the initial /info/refs fetch when you\n> clone.\n>\n> -Peff\n"},{"id":"318187","messageId":"20170428153446.z5pp55kdniubt5ia@sigill.intra.peff.net","threadId":"45820","inReplyTo":"CAH6sfJUoCPVJz47U8wA306hkCo_Z+gv5s0XHjtkGH6fj8-hUZQ@mail.gmail.com","subject":"Re: push fails with return code 22","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-04-28T15:34:46Z","receivedAt":"2017-04-28T15:34:55Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Apr 28, 2017 at 11:28:14AM -0400, Andrew Watson wrote:\n\n> $ GIT_CURL_VERBOSE=1 git clone http://git.site.domain.com/foo/gitrepo.git\n> Cloning into 'gitrepo'...\n> * Couldn't find host git.site.domain.com in the _netrc file; using defaults\n> * timeout on name lookup is not supported\n> *   Trying 192.168.16.138...\n> * TCP_NODELAY set\n> * Connected to git.site.domain.com (192.168.16.138) port 80 (#0)\n> > GET /foo/gitrepo.git/info/refs?service=git-upload-pack HTTP/1.1\n> Host: git.site.domain.com\n> User-Agent: git/2.12.2.windows.2\n> Accept: */*\n> Accept-Encoding: gzip\n> Pragma: no-cache\n> \n> < HTTP/1.1 200 OK\n> < Date: Fri, 28 Apr 2017 15:25:02 GMT\n> < Server: Apache/2.4.6 (CentOS) PHP/5.4.16\n> < Last-Modified: Tue, 25 Apr 2017 18:11:35 GMT\n> < ETag: \"0-54e01a77ac500\"\n> < Accept-Ranges: bytes\n> < Content-Length: 0\n> < Content-Type: text/plain; charset=UTF-8\n\nOK, so this is not doing smart-http either (the content-type should be\napplication/x-git-upload-pack-advertisement when the CGI generates it).\n\nLooking at your config again, I see:\n\n  ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/\n\nbut your example output shows:\n\n  GET /gitrepo.git/info/refs?service=git-receive-pack\n\nI.e., not in the /git/ hierarchy. So that might explain why the CGI is\nnot kicking in.\n\n-Peff\n"},{"id":"318189","messageId":"CAH6sfJVFKJAEm-RpAGXoTaE6eDCnFiuQaw2K1Pk2ZBu36dZvfQ@mail.gmail.com","threadId":"45820","inReplyTo":"20170428153446.z5pp55kdniubt5ia@sigill.intra.peff.net","subject":"Re: push fails with return code 22","fromName":"Andrew Watson","fromEmail":"andwatsresearch@gmail.com","sentAt":"2017-04-28T15:48:14Z","receivedAt":"2017-04-28T15:48:22Z","isPatch":false,"sender":{"key":"andwatsresearch@gmail.com","avatar":null},"body":"You are the best Peff.\n\nIt was indeed the hierarchy. So just had to change document root.\n\nThanks a bunch.\n\nOn Fri, Apr 28, 2017 at 11:34 AM, Jeff King <peff@peff.net> wrote:\n> On Fri, Apr 28, 2017 at 11:28:14AM -0400, Andrew Watson wrote:\n>\n>> $ GIT_CURL_VERBOSE=1 git clone http://git.site.domain.com/foo/gitrepo.git\n>> Cloning into 'gitrepo'...\n>> * Couldn't find host git.site.domain.com in the _netrc file; using defaults\n>> * timeout on name lookup is not supported\n>> *   Trying 192.168.16.138...\n>> * TCP_NODELAY set\n>> * Connected to git.site.domain.com (192.168.16.138) port 80 (#0)\n>> > GET /foo/gitrepo.git/info/refs?service=git-upload-pack HTTP/1.1\n>> Host: git.site.domain.com\n>> User-Agent: git/2.12.2.windows.2\n>> Accept: */*\n>> Accept-Encoding: gzip\n>> Pragma: no-cache\n>>\n>> < HTTP/1.1 200 OK\n>> < Date: Fri, 28 Apr 2017 15:25:02 GMT\n>> < Server: Apache/2.4.6 (CentOS) PHP/5.4.16\n>> < Last-Modified: Tue, 25 Apr 2017 18:11:35 GMT\n>> < ETag: \"0-54e01a77ac500\"\n>> < Accept-Ranges: bytes\n>> < Content-Length: 0\n>> < Content-Type: text/plain; charset=UTF-8\n>\n> OK, so this is not doing smart-http either (the content-type should be\n> application/x-git-upload-pack-advertisement when the CGI generates it).\n>\n> Looking at your config again, I see:\n>\n>   ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/\n>\n> but your example output shows:\n>\n>   GET /gitrepo.git/info/refs?service=git-receive-pack\n>\n> I.e., not in the /git/ hierarchy. So that might explain why the CGI is\n> not kicking in.\n>\n> -Peff\n"}]}