2013-03-07 51 views

回答

1

这里的答案就在gitweb.conf文件(通常位于/etc/gitweb.conf)

的$ per_request_config变量假设/ git的/是你的git仓库的根目录下,并且每个用户拥有该文件夹中的目录,这会为你工作:

our $per_request_config = sub { 
     $projectroot = "/git/" . $cgi->remote_user; 
}; 

你的Apache虚拟主机的配置看起来是这样的:

<VirtualHost *:443> 
     SSLEngine on 
     SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP 

     SSLCertificateFile  /ssl/mydomain.com.crt 
     SSLCertificateKeyFile /ssl/mydomain.com.key 

     DocumentRoot /git/user 
     ServerName user.mydomain.com 

     SetEnv GIT_PROJECT_ROOT /git/user 
     SetEnv GIT_HTTP_EXPORT_ALL 

     <Directory /> 
      Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch 
      AuthType Basic 
      AuthName "Private Git Access" 
      AuthUserFile "/git/git-auth" 
      Require valid-user 
      AddHandler cgi-script .cgi 
      DirectoryIndex gitweb.cgi 
     </Directory> 

     # This pattern matches git operations and passes them to http-backend 
     ScriptAliasMatch "(?x)^/(.*/(HEAD | info/refs | objects/(info/[^/]+ | [0-9a-f]{2}/[0-9a-f]{38} | pack/pack-[0-9a-f]{40}\.(pack|idx)) | git-(upload|receive)-pack))$" /usr/libexec/git-core/git-http-backend/$1 

</VirtualHost> 

我发现这是easies我可以管理git和用户。

但是,如果您遵循更传统的模型,您可以链接到每个用户的主目录中的文件夹'git'。

our $per_request_config = sub { 
     $projectroot = "/home/" . $cgi->remote_user . "/git/"; 
}; 
相关问题