我已经安装了gitweb和gitolite。我可以为gitweb访问配置一个repo,它出现在"projects.list“文件中,但在浏览器中没有被gitweb列出。
我一直在寻找,但找不到我所缺少的东西来完成这个任务。
我的gitweb.conf包含
$git_temp = "/tmp";
# The directories where your projects are. Must not end with a slash.
$projectroot = "/srv/git/repositories";
$projects_list = "/srv/git/projects.list";我的.gitolite.rc包含
$PROJECTS_LIST = $ENV{HOME} . "/projects.list";我已经检查过了,projects.list文件一旦被推回回购系统,就会根据gitlite的更改获得更新。所以我认为这只是gitweb没有看到列表并对其采取行动,但我不知道为什么。
我只是得到了gitweb页面与"404 -没有项目找到“的项目列表应该在哪里。
更新:
我发现,在我的例子中,问题是由不正确的Apache配置引起的。我跟踪了http://git@boron/testing.git。我的VirtualHost中有以下内容:
# Make sure we can execute gitweb okay
<Directory "/srv/http/gitweb">
Options ExecCGI
AllowOverride None
AddHandler cgi-script .cgi
DirectoryIndex gitweb.cgi
Order allow,deny
Allow from all
</Directory>它作为httpd用户直接执行gitweb.cgi,没有任何环境设置。我将这个块替换为对suexec包装器的显式调用:
# Call GitoWeb cgi via suexec wrapper for relevant URLs
ScriptAliasMatch "^/$" /srv/http/git-suexec/gitweb.cgi.suexec-wrapper这解决了我的问题。
发布于 2012-03-20 08:00:09
正如OP在注释中提到的,您需要确保Apache中的VirtulaHost使用正确的参数/环境变量调用gitweb.cgi:
以下是该服务的httpd.conf:
注意它将如何避免ScriptAliasMatch,以及它如何设置GIT_HTTP_BACKEND。
# GitWeb on 8443 # or any port you want
Listen 8443
<VirtualHost hostname>
ServerName hostname
ServerAlias short-hostname
SSLCertificateFile "/path/to/apache/crt"
SSLCertificateKeyFile "/path/to/apache/key"
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SetEnv GIT_HTTP_BACKEND /path/to/git/libexec/git-core/git-http-backend
DocumentRoot /path/to/gitweb
Alias /gitweb /path/to/gitweb
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /path/to/gitweb>
SSLOptions +StdEnvVars
Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All
order allow,deny
Allow from all
AuthName "LDAP authentication for GitWeb repositories"
AuthType Basic
AuthBasicProvider myldap companyldap
AuthzLDAPAuthoritative On
Require valid-user
AddHandler cgi-script cgi
DirectoryIndex gitweb.cgi
RewriteEngine Off
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^[a-zA-Z0-9_\-]+\.git/?(\?.*)?$ /gitweb.cgi%{REQUEST_URI} [L,PT]
</Directory>
</VirtualHost>原来的答案:
这是我的gitweb.conf.pl
my $gl_home = $ENV{HOME} = "@H@";
# the following variables are needed by gitolite; please edit before using
# this should normally not be anything else
$ENV{GL_RC} = "$gl_home/.gitolite.rc";
# this can have different values depending on how you installed.
# if you used RPM/DEB or "root" methods it **might** be this:
$ENV{GL_BINDIR} = "/usr/local/bin";
# if you used the "non-root" method it **might** be this:
$ENV{GL_BINDIR} = "$gl_home/gitolite/bin";
# If in doubt take a look at ~/.ssh/authorized_keys; at least one of the lines
# might contain something like:
# command="/home/git/.gitolite/src/gl-auth-command
# and you should use whatever directory the gl-auth-command is in (in this
# example /home/git/.gitolite.src)
# finally the user name
$ENV{GL_USER} = $cgi->remote_user || "gitweb";
# now get gitolite stuff in...
unshift @INC, $ENV{GL_BINDIR};
require gitolite_rc; gitolite_rc -> import;
require gitolite; gitolite -> import;
# set project root etc. absolute paths
$ENV{GL_REPO_BASE_ABS} = ( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$gl_home/$REPO_BASE" );
$projects_list = $projectroot = $ENV{GL_REPO_BASE_ABS};
$export_auth_hook = sub {
my $repo = shift;
# gitweb passes us the full repo path; so we strip the beginning
# and the end, to get the repo name as it is specified in gitolite conf
return unless $repo =~ s/^\Q$projectroot\E\/?(.+)\.git$/$1/;
# check for (at least) "R" permission
my ($perm, $creator) = &repo_rights($repo);
return ($perm =~ /R/);
};将“H”替换为.gitolite、.gitoliterc、repositories、project.list文件所在的路径。
请注意我是如何定义$ENV{GL_BINDIR}的:我没有注释第二个定义,因为在我的例子中,我做了一个非根安装,因此:
$ENV{GL_BINDIR} = "$gl_home/gitolite/bin";确保有一个gitweb_config.perl与:
our $home_link_str = "ITSVC projects";
our $site_name = "ITSVC Gitweb";
use lib (".");
require "gitweb.conf.pl";这就是为什么gitweb和额外的gitweb.conf.pl之间的联系,也就是所谓的珍珠岩。
https://stackoverflow.com/questions/9777459
复制相似问题