web-dev-qa-db-ja.com

Ubuntu、Git(git-http-backend)、Apache

Git-http-backendとApacheを組み合わせたgitに基づいてリポジトリサーバーをセットアップしようとしています。私の問題?完全にクローンを作成できますが、ti Pushを試すと、壁にぶつかります

$ 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

Apacheのログによると:

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には、cgi、alias、env modsが有効になっている必要があります。これらはすでに有効になっています。グーグルでいくつかの結果を読んだ後、dav関連モジュールを有効にして無効にしてみました。 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

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

ディレクトリ構造:

$ 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
2
Shoaibi

VHostファイルを見ると、gitバックエンドがまったく起動していないかわかりません。

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

http://git.local/git/somethingelse -DocumentRootは/ var/www/git /であり、リポジトリは次のようなページにいる場合を除いて、これは実際には何もしません。/var/www/git /の下にあるフォルダは、ナビゲートすることがないため、ScriptAlias行は目的を果たしません http://git.local/git/

1
VodkaSurprise

git config http.receivepack true/var/www/git/newを設定しましたか?

0
ephemient