git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* push fails with return code 22
@ 2017-04-27 18:37 Andrew Watson
  2017-04-27 20:18 ` Jeff King
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Watson @ 2017-04-27 18:37 UTC (permalink / raw)
  To: git

Hi,

I'm trying to setup git with Smart HTTP so we can move off of SVN.

I've used the blog post: https://git-scm.com/blog/2010/03/04/smart-http.html

I'm getting "error: Cannot access URL ... return code 22" when I try
to push. Clone works fine.

I verified authentication by replacing my LDAP stuff, which looks to
work according to Apache logs, with Require all granted.

Done a lot of googling and posted on stackoverflow at this point.

My system is CentOS 7 which reports git version 1.8.3.1 and Apache
2.4.6. I also tried on Ubuntu 16.04 with git 2.7.4 and Apache 2.4.18.

Using GIT_CURL_VERBOSE I can see it fail after a PROPFIND.

My stackoverflow post with all the debug info I could think of is
here: http://stackoverflow.com/questions/43643152/git-push-results-in-return-code-22

I'll re-post whatever is requested here if needed.

Really hoping to get this working.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: push fails with return code 22
  2017-04-27 18:37 push fails with return code 22 Andrew Watson
@ 2017-04-27 20:18 ` Jeff King
  2017-04-28 15:09   ` Andrew Watson
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff King @ 2017-04-27 20:18 UTC (permalink / raw)
  To: Andrew Watson; +Cc: git

On Thu, Apr 27, 2017 at 02:37:19PM -0400, Andrew Watson wrote:

> I'm trying to setup git with Smart HTTP so we can move off of SVN.
> 
> I've used the blog post: https://git-scm.com/blog/2010/03/04/smart-http.html

I'm not sure how that post will have aged. You might check your setup
against the documentation in "git help http-backend", which is kept more
up to date.

> My system is CentOS 7 which reports git version 1.8.3.1 and Apache
> 2.4.6. I also tried on Ubuntu 16.04 with git 2.7.4 and Apache 2.4.18.
> 
> Using GIT_CURL_VERBOSE I can see it fail after a PROPFIND.

That means the client isn't using smart-http. PROPFIND is part of the
"dumb" http push-over-webdav.

So the problem is likely in the very first request Git makes to
/info/refs/?service=git-receive-pack. The response there is what the
client uses to decide whether the server understands smart-http or not.

> My stackoverflow post with all the debug info I could think of is
> here: http://stackoverflow.com/questions/43643152/git-push-results-in-return-code-22

I notice the response for that first request has:

  Content-Length: 0
  Content-Type: text/plain; charset=UTF-8

which implies to me that the git-http-backend CGI isn't being run.

-Peff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: push fails with return code 22
  2017-04-27 20:18 ` Jeff King
@ 2017-04-28 15:09   ` Andrew Watson
  2017-04-28 15:20     ` Jeff King
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Watson @ 2017-04-28 15:09 UTC (permalink / raw)
  To: Jeff King; +Cc: git

Hi Peff,

I agree that it does look like the client isn't using smart-http. I am
using the Windows client from git-scm.com.

Thanks for pointing me to git help http-backend. I confirmed the
modules are loaded and the CGI environment variables. I've added
"AcceptPathInfo On" to my httpd.conf just to be safe.

I'm not sure what /info/refs is supposed to look like, but it is
empty. Could that be the issue?

Do you see anything in my apache configuration that looks wrong?

Andrew

On Thu, Apr 27, 2017 at 4:18 PM, Jeff King <peff@peff.net> wrote:
> On Thu, Apr 27, 2017 at 02:37:19PM -0400, Andrew Watson wrote:
>
>> I'm trying to setup git with Smart HTTP so we can move off of SVN.
>>
>> I've used the blog post: https://git-scm.com/blog/2010/03/04/smart-http.html
>
> I'm not sure how that post will have aged. You might check your setup
> against the documentation in "git help http-backend", which is kept more
> up to date.
>
>> My system is CentOS 7 which reports git version 1.8.3.1 and Apache
>> 2.4.6. I also tried on Ubuntu 16.04 with git 2.7.4 and Apache 2.4.18.
>>
>> Using GIT_CURL_VERBOSE I can see it fail after a PROPFIND.
>
> That means the client isn't using smart-http. PROPFIND is part of the
> "dumb" http push-over-webdav.
>
> So the problem is likely in the very first request Git makes to
> /info/refs/?service=git-receive-pack. The response there is what the
> client uses to decide whether the server understands smart-http or not.
>
>> My stackoverflow post with all the debug info I could think of is
>> here: http://stackoverflow.com/questions/43643152/git-push-results-in-return-code-22
>
> I notice the response for that first request has:
>
>   Content-Length: 0
>   Content-Type: text/plain; charset=UTF-8
>
> which implies to me that the git-http-backend CGI isn't being run.
>
> -Peff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: push fails with return code 22
  2017-04-28 15:09   ` Andrew Watson
@ 2017-04-28 15:20     ` Jeff King
  2017-04-28 15:28       ` Andrew Watson
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff King @ 2017-04-28 15:20 UTC (permalink / raw)
  To: Andrew Watson; +Cc: git

On Fri, Apr 28, 2017 at 11:09:55AM -0400, Andrew Watson wrote:

> Thanks for pointing me to git help http-backend. I confirmed the
> modules are loaded and the CGI environment variables. I've added
> "AcceptPathInfo On" to my httpd.conf just to be safe.
> 
> I'm not sure what /info/refs is supposed to look like, but it is
> empty. Could that be the issue?

No, that shouldn't matter. The on-disk file is used only for dumb-http
requests. In a working smart-http system, the info/refs request should
go to the CGI, which will generate the ref advertisement dynamically.

> Do you see anything in my apache configuration that looks wrong?

It looks reasonable to me, but I'm far from an expert on Apache config.

When you clone, is it using smart-http there? Try using GIT_CURL_VERBOSE
to see what the response is to the initial /info/refs fetch when you
clone.

-Peff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: push fails with return code 22
  2017-04-28 15:20     ` Jeff King
@ 2017-04-28 15:28       ` Andrew Watson
  2017-04-28 15:34         ` Jeff King
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Watson @ 2017-04-28 15:28 UTC (permalink / raw)
  To: Jeff King; +Cc: git

Hi Peff,

Thanks for the help.

$ GIT_CURL_VERBOSE=1 git clone http://git.site.domain.com/foo/gitrepo.git
Cloning into 'gitrepo'...
* Couldn't find host git.site.domain.com in the _netrc file; using defaults
* timeout on name lookup is not supported
*   Trying 192.168.16.138...
* TCP_NODELAY set
* Connected to git.site.domain.com (192.168.16.138) port 80 (#0)
> GET /foo/gitrepo.git/info/refs?service=git-upload-pack HTTP/1.1
Host: git.site.domain.com
User-Agent: git/2.12.2.windows.2
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

< HTTP/1.1 200 OK
< Date: Fri, 28 Apr 2017 15:25:02 GMT
< Server: Apache/2.4.6 (CentOS) PHP/5.4.16
< Last-Modified: Tue, 25 Apr 2017 18:11:35 GMT
< ETag: "0-54e01a77ac500"
< Accept-Ranges: bytes
< Content-Length: 0
< Content-Type: text/plain; charset=UTF-8
<
* Connection #0 to host git.site.domain.com left intact
* Couldn't find host git.site.domain.com in the _netrc file; using defaults
* Found bundle for host git.site.domain.com: 0x1cc9fc0 [can pipeline]
* Re-using existing connection! (#0) with host git.site.domain.com
* Connected to git.site.domain.com (192.168.16.138) port 80 (#0)
> GET /foo/gitrepo.git/HEAD HTTP/1.1
Host: git.site.domain.com
User-Agent: git/2.12.2.windows.2
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

< HTTP/1.1 200 OK
< Date: Fri, 28 Apr 2017 15:25:02 GMT
< Server: Apache/2.4.6 (CentOS) PHP/5.4.16
< Last-Modified: Mon, 24 Apr 2017 20:51:42 GMT
< ETag: "17-54defc6469818"
< Accept-Ranges: bytes
< Content-Length: 23
<
* Connection #0 to host git.site.domain.com left intact
warning: You appear to have cloned an empty repository.

Content length is again 0.

On Fri, Apr 28, 2017 at 11:20 AM, Jeff King <peff@peff.net> wrote:
> On Fri, Apr 28, 2017 at 11:09:55AM -0400, Andrew Watson wrote:
>
>> Thanks for pointing me to git help http-backend. I confirmed the
>> modules are loaded and the CGI environment variables. I've added
>> "AcceptPathInfo On" to my httpd.conf just to be safe.
>>
>> I'm not sure what /info/refs is supposed to look like, but it is
>> empty. Could that be the issue?
>
> No, that shouldn't matter. The on-disk file is used only for dumb-http
> requests. In a working smart-http system, the info/refs request should
> go to the CGI, which will generate the ref advertisement dynamically.
>
>> Do you see anything in my apache configuration that looks wrong?
>
> It looks reasonable to me, but I'm far from an expert on Apache config.
>
> When you clone, is it using smart-http there? Try using GIT_CURL_VERBOSE
> to see what the response is to the initial /info/refs fetch when you
> clone.
>
> -Peff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: push fails with return code 22
  2017-04-28 15:28       ` Andrew Watson
@ 2017-04-28 15:34         ` Jeff King
  2017-04-28 15:48           ` Andrew Watson
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff King @ 2017-04-28 15:34 UTC (permalink / raw)
  To: Andrew Watson; +Cc: git

On Fri, Apr 28, 2017 at 11:28:14AM -0400, Andrew Watson wrote:

> $ GIT_CURL_VERBOSE=1 git clone http://git.site.domain.com/foo/gitrepo.git
> Cloning into 'gitrepo'...
> * Couldn't find host git.site.domain.com in the _netrc file; using defaults
> * timeout on name lookup is not supported
> *   Trying 192.168.16.138...
> * TCP_NODELAY set
> * Connected to git.site.domain.com (192.168.16.138) port 80 (#0)
> > GET /foo/gitrepo.git/info/refs?service=git-upload-pack HTTP/1.1
> Host: git.site.domain.com
> User-Agent: git/2.12.2.windows.2
> Accept: */*
> Accept-Encoding: gzip
> Pragma: no-cache
> 
> < HTTP/1.1 200 OK
> < Date: Fri, 28 Apr 2017 15:25:02 GMT
> < Server: Apache/2.4.6 (CentOS) PHP/5.4.16
> < Last-Modified: Tue, 25 Apr 2017 18:11:35 GMT
> < ETag: "0-54e01a77ac500"
> < Accept-Ranges: bytes
> < Content-Length: 0
> < Content-Type: text/plain; charset=UTF-8

OK, so this is not doing smart-http either (the content-type should be
application/x-git-upload-pack-advertisement when the CGI generates it).

Looking at your config again, I see:

  ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/

but your example output shows:

  GET /gitrepo.git/info/refs?service=git-receive-pack

I.e., not in the /git/ hierarchy. So that might explain why the CGI is
not kicking in.

-Peff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: push fails with return code 22
  2017-04-28 15:34         ` Jeff King
@ 2017-04-28 15:48           ` Andrew Watson
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Watson @ 2017-04-28 15:48 UTC (permalink / raw)
  To: Jeff King; +Cc: git

You are the best Peff.

It was indeed the hierarchy. So just had to change document root.

Thanks a bunch.

On Fri, Apr 28, 2017 at 11:34 AM, Jeff King <peff@peff.net> wrote:
> On Fri, Apr 28, 2017 at 11:28:14AM -0400, Andrew Watson wrote:
>
>> $ GIT_CURL_VERBOSE=1 git clone http://git.site.domain.com/foo/gitrepo.git
>> Cloning into 'gitrepo'...
>> * Couldn't find host git.site.domain.com in the _netrc file; using defaults
>> * timeout on name lookup is not supported
>> *   Trying 192.168.16.138...
>> * TCP_NODELAY set
>> * Connected to git.site.domain.com (192.168.16.138) port 80 (#0)
>> > GET /foo/gitrepo.git/info/refs?service=git-upload-pack HTTP/1.1
>> Host: git.site.domain.com
>> User-Agent: git/2.12.2.windows.2
>> Accept: */*
>> Accept-Encoding: gzip
>> Pragma: no-cache
>>
>> < HTTP/1.1 200 OK
>> < Date: Fri, 28 Apr 2017 15:25:02 GMT
>> < Server: Apache/2.4.6 (CentOS) PHP/5.4.16
>> < Last-Modified: Tue, 25 Apr 2017 18:11:35 GMT
>> < ETag: "0-54e01a77ac500"
>> < Accept-Ranges: bytes
>> < Content-Length: 0
>> < Content-Type: text/plain; charset=UTF-8
>
> OK, so this is not doing smart-http either (the content-type should be
> application/x-git-upload-pack-advertisement when the CGI generates it).
>
> Looking at your config again, I see:
>
>   ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
>
> but your example output shows:
>
>   GET /gitrepo.git/info/refs?service=git-receive-pack
>
> I.e., not in the /git/ hierarchy. So that might explain why the CGI is
> not kicking in.
>
> -Peff

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-04-28 15:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-27 18:37 push fails with return code 22 Andrew Watson
2017-04-27 20:18 ` Jeff King
2017-04-28 15:09   ` Andrew Watson
2017-04-28 15:20     ` Jeff King
2017-04-28 15:28       ` Andrew Watson
2017-04-28 15:34         ` Jeff King
2017-04-28 15:48           ` Andrew Watson

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).