git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Fail to push over HTTP with MySQL authentication (Apache2)
@ 2012-12-29 19:54 Davide Baldini
  2012-12-29 21:01 ` Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: Davide Baldini @ 2012-12-29 19:54 UTC (permalink / raw)
  To: git

Hi,

I'm not able to setup a public Git repository over plain HTTP with
MySQL authentication.
Both HTTP and authentication are provided by Apache2.

SETUP:
-----

This setup is performed on Debian 6.0.4.

Apache2 (v. 2.2), with modules:
    auth_mysql
    WebDAV

Git (v. 1.7.8.3)
Git repository location:
    local, for webserver: /var/www/public/GT_rulesets/GT00.git
    public, for Git:      http://greatturn.org:8081/GT00.git

Git repository has been configured as:
    cd /var/www/public/GT_rulesets/GT00.git
    git init --bare
    mv hooks/post-update.sample hooks/post-update
    git update server-info
    chmode 777 /var/www/public/GT_rulesets/GT00.git  # for testing.


FACTS:
-----

The Apache side of my setup seems to work:
_   HTTP, MySQL authentication:
        I point Iceweasel to http://greatturn.org:8081/ .
        It asks for authentication; I authenticate with a username/
        password pair taken from MySQL database (which doesn't exist as
        a system user); It works, and I can see all the content of
        the git repository "GT00.git".
_   WebDAV:
        I point Konqueror to webdav://greatturn.org:8081/ .
        Works exactly as previous point.
_   Git:
        Git can fetch the repository without problems:
        git clone http://username:password@greatturn.org:8081/GT00.git

Pushing the locally fetched repository back to the remote one doesn't
work:
    "git push http://greatturn.org:8081/GT00.git master"
    asks for username and password:
        > Username for 'greatturn.org:8081':
        > Password for 'greatturn.org:8081':

    I enter my credentials, then git outputs the following and exits:
        > error: Cannot access URL http://greatturn.org:8081/GT00.git/,
return code 22
        > fatal: git-http-push failed

    On Apache's access.log, git produces all and no more than the
    following:
        > 87.19.240.177 - - [29/Dec/2012:16:43:22 +0100] "GET /GT00.git
/info/refs?service=git-receive-pack HTTP/1.1" 401 767 "-"
"git/1.7.8.3"
        > 87.19.240.177 - - [29/Dec/2012:16:43:26 +0100] "GET
/GT00.git/info/refs?service=git-receive-pack HTTP/1.1" 401 767 "-"
"git/1.7.8.3"
        > 87.19.240.177 - davide [29/Dec/2012:16:43:26 +0100] "GET
/GT00.git/info/refs?service=git-receive-pack HTTP/1.1" 200 233 "-"
"git/1.7.8.3"
        > 87.19.240.177 - davide [29/Dec/2012:16:43:26 +0100] "GET
/GT00.git/HEAD HTTP/1.1" 200 258 "-" "git/1.7.8.3"
        > 87.19.240.177 - - [29/Dec/2012:16:43:26 +0100] "PROPFIND
/GT00.git/ HTTP/1.1" 401 767 "-" "git/1.7.8.3"

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

* Re: Fail to push over HTTP with MySQL authentication (Apache2)
  2012-12-29 19:54 Fail to push over HTTP with MySQL authentication (Apache2) Davide Baldini
@ 2012-12-29 21:01 ` Jeff King
  2012-12-30  0:27   ` Davide Baldini
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2012-12-29 21:01 UTC (permalink / raw)
  To: Davide Baldini; +Cc: git

On Sat, Dec 29, 2012 at 08:54:32PM +0100, Davide Baldini wrote:

> SETUP:
> -----
> [...]
> Git repository has been configured as:
>     cd /var/www/public/GT_rulesets/GT00.git
>     git init --bare
>     mv hooks/post-update.sample hooks/post-update
>     git update server-info
>     chmode 777 /var/www/public/GT_rulesets/GT00.git  # for testing.

Should this last line be a "chmod -R"? Git init will create many
subdirectories, and you want to make sure they are all writable for
push.

> _   Git:
>         Git can fetch the repository without problems:
>         git clone http://username:password@greatturn.org:8081/GT00.git
> 
> Pushing the locally fetched repository back to the remote one doesn't
> work:
> [...]
> > 87.19.240.177 - - [29/Dec/2012:16:43:26 +0100] "PROPFIND /GT00.git/ HTTP/1.1" 401 767 "-" "git/1.7.8.3"

If fetch is working and push is not, I'd suspect WebDAV configuration
problems (and indeed, your credentials seem fine, but the PROPFIND is
returning a 401). Fetch works over stock HTTP and does not use WebDAV at
all. There is some documentation on setting up DAV here:

  https://github.com/git/git/blob/master/Documentation/howto/setup-git-server-over-http.txt

but I have no idea if it is up-to-date or not.

However, before trying to investigate that avenue, have you considered
using git's smart-http backend instead of WebDAV? It's significantly
more efficient. You can get details and example apache configuration
from "git help http-backend".

-Peff

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

* Re: Fail to push over HTTP with MySQL authentication (Apache2)
  2012-12-29 21:01 ` Jeff King
@ 2012-12-30  0:27   ` Davide Baldini
  0 siblings, 0 replies; 3+ messages in thread
From: Davide Baldini @ 2012-12-30  0:27 UTC (permalink / raw)
  To: git

On 12/29/12 22:01, Jeff King wrote:

> However, before trying to investigate that avenue, have you considered
> using git's smart-http backend instead of WebDAV? It's significantly
> more efficient. You can get details and example apache configuration
> from "git help http-backend".

Thank you for the suggestions, I've been able to have the setup running.
I abandoned the horrible WebDAV in favour of Smart HTTP, and it's been
quite straightforward to configure and run successfully.

There is some documentation on setting up DAV here:
> 
>   https://github.com/git/git/blob/master/Documentation/howto/setup-git-server-over-http.txt
> 
> but I have no idea if it is up-to-date or not.

No it's not up-to-date. It should refer to Apache versions <2.0 .
Some of its config directives are inexistent in modern Apaches.

- Davide

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

end of thread, other threads:[~2012-12-30  0:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-29 19:54 Fail to push over HTTP with MySQL authentication (Apache2) Davide Baldini
2012-12-29 21:01 ` Jeff King
2012-12-30  0:27   ` Davide Baldini

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).