{"thread":{"id":"32475","subject":"Fail to push over HTTP with MySQL authentication (Apache2)","startedAt":"2012-12-29T19:54:32Z","lastAt":"2012-12-30T00:27:29Z","messageCount":3,"participants":["Davide Baldini","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"205658","messageId":"50DF4A78.5000206@gmail.com","threadId":"32475","inReplyTo":null,"subject":"Fail to push over HTTP with MySQL authentication (Apache2)","fromName":"Davide Baldini","fromEmail":"baldiniebaldini@gmail.com","sentAt":"2012-12-29T19:54:32Z","receivedAt":"2012-12-29T19:54:32Z","isPatch":false,"sender":{"key":"baldiniebaldini@gmail.com","avatar":null},"body":"Hi,\n\nI'm not able to setup a public Git repository over plain HTTP with\nMySQL authentication.\nBoth HTTP and authentication are provided by Apache2.\n\nSETUP:\n-----\n\nThis setup is performed on Debian 6.0.4.\n\nApache2 (v. 2.2), with modules:\n    auth_mysql\n    WebDAV\n\nGit (v. 1.7.8.3)\nGit repository location:\n    local, for webserver: /var/www/public/GT_rulesets/GT00.git\n    public, for Git:      http://greatturn.org:8081/GT00.git\n\nGit repository has been configured as:\n    cd /var/www/public/GT_rulesets/GT00.git\n    git init --bare\n    mv hooks/post-update.sample hooks/post-update\n    git update server-info\n    chmode 777 /var/www/public/GT_rulesets/GT00.git  # for testing.\n\n\nFACTS:\n-----\n\nThe Apache side of my setup seems to work:\n_   HTTP, MySQL authentication:\n        I point Iceweasel to http://greatturn.org:8081/ .\n        It asks for authentication; I authenticate with a username/\n        password pair taken from MySQL database (which doesn't exist as\n        a system user); It works, and I can see all the content of\n        the git repository \"GT00.git\".\n_   WebDAV:\n        I point Konqueror to webdav://greatturn.org:8081/ .\n        Works exactly as previous point.\n_   Git:\n        Git can fetch the repository without problems:\n        git clone http://username:password@greatturn.org:8081/GT00.git\n\nPushing the locally fetched repository back to the remote one doesn't\nwork:\n    \"git push http://greatturn.org:8081/GT00.git master\"\n    asks for username and password:\n        > Username for 'greatturn.org:8081':\n        > Password for 'greatturn.org:8081':\n\n    I enter my credentials, then git outputs the following and exits:\n        > error: Cannot access URL http://greatturn.org:8081/GT00.git/,\nreturn code 22\n        > fatal: git-http-push failed\n\n    On Apache's access.log, git produces all and no more than the\n    following:\n        > 87.19.240.177 - - [29/Dec/2012:16:43:22 +0100] \"GET /GT00.git\n/info/refs?service=git-receive-pack HTTP/1.1\" 401 767 \"-\"\n\"git/1.7.8.3\"\n        > 87.19.240.177 - - [29/Dec/2012:16:43:26 +0100] \"GET\n/GT00.git/info/refs?service=git-receive-pack HTTP/1.1\" 401 767 \"-\"\n\"git/1.7.8.3\"\n        > 87.19.240.177 - davide [29/Dec/2012:16:43:26 +0100] \"GET\n/GT00.git/info/refs?service=git-receive-pack HTTP/1.1\" 200 233 \"-\"\n\"git/1.7.8.3\"\n        > 87.19.240.177 - davide [29/Dec/2012:16:43:26 +0100] \"GET\n/GT00.git/HEAD HTTP/1.1\" 200 258 \"-\" \"git/1.7.8.3\"\n        > 87.19.240.177 - - [29/Dec/2012:16:43:26 +0100] \"PROPFIND\n/GT00.git/ HTTP/1.1\" 401 767 \"-\" \"git/1.7.8.3\"\n"},{"id":"205660","messageId":"20121229210128.GB21058@sigill.intra.peff.net","threadId":"32475","inReplyTo":"50DF4A78.5000206@gmail.com","subject":"Re: Fail to push over HTTP with MySQL authentication (Apache2)","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-12-29T21:01:28Z","receivedAt":"2012-12-29T21:01:28Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Dec 29, 2012 at 08:54:32PM +0100, Davide Baldini wrote:\n\n> SETUP:\n> -----\n> [...]\n> Git repository has been configured as:\n>     cd /var/www/public/GT_rulesets/GT00.git\n>     git init --bare\n>     mv hooks/post-update.sample hooks/post-update\n>     git update server-info\n>     chmode 777 /var/www/public/GT_rulesets/GT00.git  # for testing.\n\nShould this last line be a \"chmod -R\"? Git init will create many\nsubdirectories, and you want to make sure they are all writable for\npush.\n\n> _   Git:\n>         Git can fetch the repository without problems:\n>         git clone http://username:password@greatturn.org:8081/GT00.git\n> \n> Pushing the locally fetched repository back to the remote one doesn't\n> work:\n> [...]\n> > 87.19.240.177 - - [29/Dec/2012:16:43:26 +0100] \"PROPFIND /GT00.git/ HTTP/1.1\" 401 767 \"-\" \"git/1.7.8.3\"\n\nIf fetch is working and push is not, I'd suspect WebDAV configuration\nproblems (and indeed, your credentials seem fine, but the PROPFIND is\nreturning a 401). Fetch works over stock HTTP and does not use WebDAV at\nall. There is some documentation on setting up DAV here:\n\n  https://github.com/git/git/blob/master/Documentation/howto/setup-git-server-over-http.txt\n\nbut I have no idea if it is up-to-date or not.\n\nHowever, before trying to investigate that avenue, have you considered\nusing git's smart-http backend instead of WebDAV? It's significantly\nmore efficient. You can get details and example apache configuration\nfrom \"git help http-backend\".\n\n-Peff\n"},{"id":"205665","messageId":"50DF8A71.8040909@gmail.com","threadId":"32475","inReplyTo":"20121229210128.GB21058@sigill.intra.peff.net","subject":"Re: Fail to push over HTTP with MySQL authentication (Apache2)","fromName":"Davide Baldini","fromEmail":"baldiniebaldini@gmail.com","sentAt":"2012-12-30T00:27:29Z","receivedAt":"2012-12-30T00:27:29Z","isPatch":false,"sender":{"key":"baldiniebaldini@gmail.com","avatar":null},"body":"On 12/29/12 22:01, Jeff King wrote:\n\n> However, before trying to investigate that avenue, have you considered\n> using git's smart-http backend instead of WebDAV? It's significantly\n> more efficient. You can get details and example apache configuration\n> from \"git help http-backend\".\n\nThank you for the suggestions, I've been able to have the setup running.\nI abandoned the horrible WebDAV in favour of Smart HTTP, and it's been\nquite straightforward to configure and run successfully.\n\nThere is some documentation on setting up DAV here:\n> \n>   https://github.com/git/git/blob/master/Documentation/howto/setup-git-server-over-http.txt\n> \n> but I have no idea if it is up-to-date or not.\n\nNo it's not up-to-date. It should refer to Apache versions <2.0 .\nSome of its config directives are inexistent in modern Apaches.\n\n- Davide\n"}]}