cgit + redmine + git (高级集成)

cgit + redmine + git (高级集成)

我已经成功配置了我的 Redmine 并实现了高级 git 集成。但是,我对将 cgit 与当前配置结合起来非常感兴趣,但我不知道该怎么做。所以,基本上我想通过结合这两个配置来使用 cgit 和 Redmine 的身份验证。

这是我的工作配置(仅当我禁用其中一个时才会起作用):

cgit 配置

<VirtualHost *:80>                                       
    ServerName git.domain
    DocumentRoot "/var/www/htdocs/cgit/" 
    DirectoryIndex cgit.cgi
    SetEnv  CGIT_CONFIG   /etc/cgitrc

    <Directory "/var/www/htdocs/cgit">
        Options FollowSymlinks ExecCGI
        Allow from all
        AllowOverride all
        Order allow,deny

        <Files cgit.cgi>
            SetHandler cgi-script
        </Files>

        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^.* /cgit.cgi/$0 [L,PT]
    </Directory>

    <Directory "/opt/git">
        Allow from all
    </Directory>
</VirtualHost>

通过 Redmine 进行 Git 身份验证

<VirtualHost *:80>
  ServerName git.domain
  DocumentRoot /opt/git

  SetEnv GIT_PROJECT_ROOT /opt/git
  SetEnv GIT_HTTP_EXPORT_ALL
  SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER

  ScriptAlias / /usr/lib/git-core/git-http-backend/
  AliasMatch ^/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$          /opt/git/$1
  AliasMatch ^/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /opt/git/$1

  PerlLoadModule Apache::Redmine

  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/lib/git-core/git-http-backend/$1

  <Directory /usr/libexec/git-core/>
    Options +ExecCGI
    Allow From All
  </Directory>

  <Location "/">
    AuthType Basic
    AuthName "Git Repositories" 
    Require valid-user

    PerlAccessHandler Apache::Authn::Redmine::access_handler
    PerlAuthenHandler Apache::Authn::Redmine::authen_handler

    RedmineDSN "DBI:mysql:database=redmine;host=localhost" 

    RedmineDbUser "redmine" 
    RedmineDbPass "redmine password" 
    RedmineGitSmartHttp yes
  </Location>
</VirtualHost>

相关内容