因此,我设置了一个运行 debian stable (squeeze) 的简单服务器,并配置了 git。
使用 gitolite,我可以使用所有功能(至少是基本的克隆/推送/拉取/提交)。gitweb
的安装没有任何问题。但是,当我访问 gitweb 时,我得到的是没有列出任何存储库的 gitweb 屏幕。
# tail -n 1 /var/log/apache2/error.log
[DATE] [error] [client IP_ADDRESS] fatal: Not a git repository: '/var/lib/gitolite/repositories/testrepo.git'
# cd /var/lib/gitolite/repositories/testrepo.git
# ls
branches config HEAD hooks info objects refs
以下是我看到的内容/var/lib/gitolite/projects.list
:
testrepo.git
并且/etc/gitweb.conf
:
# path to git projects (<project>.git)
$projectroot = "/var/lib/gitolite/repositories";
# directory to use for temp files
$git_temp = "/tmp";
# target of the home link on top of all pages
#$home_link = $my_uri || "/";
# html text to include at home page
$home_text = "indextext.html";
# file with project list; by default, simply scan the projectroot dir.
$projects_list = "/var/lib/gitolite/projects.list";
# stylesheet to use
$stylesheet = "gitweb.css";
# javascript code for gitweb
$javascript = "gitweb.js";
# logo to use
$logo = "git-logo.png";
# the 'favicon'
$favicon = "git-favicon.png";
缺什么?
编辑:搞清楚了,当我对存储库进行 chmod 时,我忘记添加 -R 开关!我更改了 umask,但这不具有追溯力……并且忘记了 chmod 只会更改目录,而不会更改任何内容。
@VonC,谢谢你的配置。虽然配置不是问题,但我确实得到了一些超出我目前最低配置的好主意。我会投票给你,但目前还不能。
答案1
这是我的“gitweb-gitolite”配置,希望可以帮助您找到配置中缺少的内容:
我已经gitweb.conf.pl
在结尾处添加了我的gitweb_config.perl
(如在gitolite 文档)像这样:
use lib (".");
require "gitweb.conf.pl";
以下是我的gitweb.conf.pl
改编gitolite/contrib/gitweb/gitweb.conf
:(
请注意,我有自定义路径)
# --------------------------------------------
# Per-repo authorization based on gitolite ACL
# Include this in gitweb.conf
# See doc/3-faq-tips-etc.mkd for more info
# please note that the author does not have personal experience with gitweb
# and does not use it. Some testing may be required. Patches welcome but
# please make sure they are tested against a "github" version of gitolite
# and not an RPM or a DEB, for obvious reasons.
# HOME of the gitolite user
my $gl_home = $ENV{HOME} = "/home/mccprdg1";
# 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 installed using the 'from-client' method it will be this:
$ENV{GL_BINDIR} = "$gl_home/.gitolite/src";
# 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/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/);
};
正如在管理文档,我的.gitolite.rc
文件包含:
$PROJECTS_LIST = $ENV{HOME} . "/projects.list";
,它引用的存储库与(等于)中定义的reponames.git
目录中存在的存储库相同:$projects_list
gitweb.conf.pl
$projects_list
$gl_home/repositories
> grep REPO_BASE *
gitweb.conf.pl:$ENV{GL_REPO_BASE_ABS} = ( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$gl_home/$REPO_BASE" );
gitweb.conf.pl:$projects_list = $projectroot = $ENV{GL_REPO_BASE_ABS};
REPO_BASE
在文件中定义.gitolite.rc
:
> grep REPO_BA .gitolite*
.gitolite.rc:$REPO_BASE="repositories";