Ubuntu, Git (git-http-backend) e Apache

2

Estou tentando configurar um servidor de repositório com base no git combinada com seu git-http-backend e apache. Meu problema? Eu posso clonar perfeitamente, mas quando eu tento empurrar, eu bato na parede

$ git push origin master
* Couldn't find host git.local in the .netrc file; using defaults
* About to connect() to git.local port 80 (#0)
*   Trying 127.0.0.1... * connected
* Connected to git.local (127.0.0.1) port 80 (#0)
> GET /new/info/refs?service=git-receive-pack HTTP/1.1
User-Agent: git/1.7.1
Host: git.local
Accept: */*
Pragma: no-cache

< HTTP/1.1 401 Authorization Required
< Date: Tue, 23 Nov 2010 16:21:51 GMT
< Server: Apache/2.2.16 (Ubuntu)
< WWW-Authenticate: Basic realm="Private Git Access"
< Vary: Accept-Encoding
< Content-Length: 476
< Content-Type: text/html; charset=iso-8859-1
< 
* Ignoring the response-body
* Connection #0 to host git.local left intact
* Issue another request to this URL: 'http://shoaibi:[email protected]/new/info/refs?service=git-receive-pack'
* Couldn't find host git.local in the .netrc file; using defaults
* Re-using existing connection! (#0) with host git.local
* Connected to git.local (127.0.0.1) port 80 (#0)
* Server auth using Basic with user 'shoaibi'
> GET /new/info/refs?service=git-receive-pack HTTP/1.1
Authorization: Basic c2hvYWliaTpzaG9haWJp
User-Agent: git/1.7.1
Host: git.local
Accept: */*
Pragma: no-cache

< HTTP/1.1 200 OK
< Date: Tue, 23 Nov 2010 16:21:51 GMT
< Server: Apache/2.2.16 (Ubuntu)
< Last-Modified: Tue, 23 Nov 2010 15:30:17 GMT
< ETag: "8853-0-495ba0cca2f10"
< Accept-Ranges: bytes
< Content-Length: 0
< Content-Type: text/plain
< 
* Connection #0 to host git.local left intact
* Couldn't find host git.local in the .netrc file; using defaults
* Re-using existing connection! (#0) with host git.local
* Connected to git.local (127.0.0.1) port 80 (#0)
* Server auth using Basic with user 'shoaibi'
> GET /new/HEAD HTTP/1.1
Authorization: Basic c2hvYWliaTpzaG9haWJp
User-Agent: git/1.7.1
Host: git.local
Accept: */*
Pragma: no-cache

< HTTP/1.1 200 OK
< Date: Tue, 23 Nov 2010 16:21:51 GMT
< Server: Apache/2.2.16 (Ubuntu)
< Last-Modified: Tue, 23 Nov 2010 12:05:07 GMT
< ETag: "88b7-17-495b72f0814f0"
< Accept-Ranges: bytes
< Content-Length: 23
< Content-Type: text/plain
< 
* Expire cleared
* Connection #0 to host git.local left intact
* Couldn't find host git.local in the .netrc file; using defaults
* About to connect() to git.local port 80 (#0)
*   Trying 127.0.0.1... * connected
* Connected to git.local (127.0.0.1) port 80 (#0)
> PROPFIND /new/ HTTP/1.1
User-Agent: git/1.7.1
Host: git.local
Accept: */*
Depth: 0
Content-Type: text/xml
Content-Length: 167
Expect: 100-continue

< HTTP/1.1 401 Authorization Required
< Date: Tue, 23 Nov 2010 16:21:51 GMT
< Server: Apache/2.2.16 (Ubuntu)
< WWW-Authenticate: Basic realm="Private Git Access"
< Vary: Accept-Encoding
< Content-Length: 476
< Content-Type: text/html; charset=iso-8859-1
< 
* Expire cleared
* Closing connection #0
* Issue another request to this URL: 'http://shoaibi:[email protected]/new/'
* Couldn't find host git.local in the .netrc file; using defaults
* About to connect() to git.local port 80 (#0)
*   Trying 127.0.0.1... * connected
* Connected to git.local (127.0.0.1) port 80 (#0)
* Server auth using Basic with user 'shoaibi'
> PROPFIND /new/ HTTP/1.1
Authorization: Basic c2hvYWliaTpzaG9haWJp
User-Agent: git/1.7.1
Host: git.local
Accept: */*
Depth: 0
Content-Type: text/xml
Content-Length: 167
Expect: 100-continue

< HTTP/1.1 100 Continue
* The requested URL returned error: 405
* Expire cleared
* Closing connection #0
error: Cannot access URL http://shoaibi:[email protected]/new/, return code 22
fatal: git-http-push failed

Os registros do Apache dizem:

127.0.0.1 - - [23/Nov/2010:21:21:51 +0500] "GET /new/info/refs?service=git-receive-pack HTTP/1.1" 401 725
127.0.0.1 - shoaibi [23/Nov/2010:21:21:51 +0500] "GET /new/info/refs?service=git-receive-pack HTTP/1.1" 200 231
127.0.0.1 - shoaibi [23/Nov/2010:21:21:51 +0500] "GET /new/HEAD HTTP/1.1" 200 256
127.0.0.1 - - [23/Nov/2010:21:21:51 +0500] "PROPFIND /new/ HTTP/1.1" 401 725
127.0.0.1 - shoaibi [23/Nov/2010:21:21:51 +0500] "PROPFIND /new/ HTTP/1.1" 405 553

git-http-backend requer cgi, alias e env mods habilitados, estes já estão habilitados, eu até tentei habilitar e desabilitar módulos relacionados ao dav depois de ler alguns resultados no google. Módulos habilitados do Apache:

 $apache2ctl -M
Loaded Modules:
 core_module (static)
 log_config_module (static)
 logio_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 alias_module (shared)
 auth_basic_module (shared)
 authn_file_module (shared)
 authz_default_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cache_module (shared)
 cgi_module (shared)
 dav_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 mem_cache_module (shared)
 mime_module (shared)
 security2_module (shared)
 negotiation_module (shared)
 php5_module (shared)
 proxy_module (shared)
 proxy_ajp_module (shared)
 proxy_balancer_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 ssl_module (shared)
 status_module (shared)
 unique_id_module (shared)
 userdir_module (shared)
Syntax OK

Vhost do Apache:

<VirtualHost *:80>
        ServerName www.git.local
        ServerAlias git.local
        ServerAdmin [email protected]
        DocumentRoot /var/www/git/

        SetEnv GIT_PROJECT_ROOT /var/www/git
        SetEnv GIT_HTTP_EXPORT_ALL
        ScriptAlias /git/ /usr/lib/git-core/git-http-backend
        <Directory />
            Options +ExecCGI
            Allow From All
        </Directory>


        <Location />
                AuthType Basic
                AuthName "Private Git Access"
                Require group committers
                AuthUserFile /var/www/git/.htpasswd
                AuthGroupFile /var/www/git/.htgroup
        </Location>

        ErrorLog /var/log/apache2/git-error_log
        CustomLog /var/log/apache2/git-access_log common


</VirtualHost>

htpasswd:

$ cat .htpasswd
shoaibi:HSt/9CzkstIUM

htgroup:

$ cat .htgroup
committers: shoaibi

Estrutura de Diretórios:

$ ls -al
total 28
drwxrwxr-x  4 www-data shoaibi 4096 2010-11-23 17:05 .
drwxrwxr-x 17 www-data shoaibi 4096 2010-11-23 11:46 ..
-rwxrwxr-x  1 www-data shoaibi   20 2010-11-23 16:51 .htgroup
-rwxrwxr-x  1 www-data shoaibi   22 2010-11-23 16:50 .htpasswd
-rwxrwxr-x  1 www-data shoaibi    9 2010-11-23 15:46 index.html
drwxrwxr-x  7 www-data shoaibi 4096 2010-11-23 11:53 myrepo.git
drwxrwxr-x  7 www-data shoaibi 4096 2010-11-23 17:05 new


$ ls -al new
total 40
drwxrwxr-x 7 www-data shoaibi 4096 2010-11-23 17:05 .
drwxrwxr-x 4 www-data shoaibi 4096 2010-11-23 17:05 ..
drwxrwxr-x 2 www-data shoaibi 4096 2010-11-23 17:05 branches
-rwxrwxr-x 1 www-data shoaibi   66 2010-11-23 17:05 config
-rwxrwxr-x 1 www-data shoaibi   73 2010-11-23 17:05 description
-rwxrwxr-x 1 www-data shoaibi   23 2010-11-23 17:05 HEAD
drwxrwxr-x 2 www-data shoaibi 4096 2010-11-23 17:05 hooks
drwxrwxr-x 2 www-data shoaibi 4096 2010-11-23 20:30 info
drwxrwxr-x 4 www-data shoaibi 4096 2010-11-23 17:05 objects
drwxrwxr-x 4 www-data shoaibi 4096 2010-11-23 17:05 refs


 $ ls -al myrepo.git
total 40
drwxrwxr-x 7 www-data shoaibi 4096 2010-11-23 11:53 .
drwxrwxr-x 4 www-data shoaibi 4096 2010-11-23 17:05 ..
drwxrwxr-x 2 www-data shoaibi 4096 2010-11-23 11:53 branches
-rwxrwxr-x 1 www-data shoaibi   66 2010-11-23 11:53 config
-rwxrwxr-x 1 www-data shoaibi   73 2010-11-23 11:53 description
-rwxrwxr-x 1 www-data shoaibi   23 2010-11-23 11:53 HEAD
drwxrwxr-x 2 www-data shoaibi 4096 2010-11-23 11:53 hooks
drwxrwxr-x 2 www-data shoaibi 4096 2010-11-23 16:20 info
drwxrwxr-x 4 www-data shoaibi 4096 2010-11-23 11:53 objects
drwxrwxr-x 4 www-data shoaibi 4096 2010-11-23 11:53 refs
    
por Shoaibi 23.11.2010 / 17:35

2 respostas

1

Olhando para o seu arquivo VHost, não tenho certeza se o git backend está disparando.

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

Isso não fará nada, a menos que você esteja em uma página como o link - Como seu DocumentRoot é / var / www / git /, e seus repositórios são pastas em / var / www / git / a linha ScriptAlias não serve para nada, pois você nunca estará navegando link

    
por 12.04.2011 / 02:21
0

Você definiu git config http.receivepack true em /var/www/git/new ?

    
por 23.11.2010 / 17:50