所以我build立了一个运行debian stable(squeeze)的简单服务器,并configuration了git。
使用gitolite,我有所有的function(至less是基本的克隆/推/拉/提交)工作。
安装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";
什么不见了?
编辑:想通了,当我已经忘记添加-R开关chmod'd存储库! 我改变了umask,但这不是追溯…忘了chmod只会改变目录,而不是任何内容。
@VonC,感谢您的configuration。 虽然configuration不是问题,但我确实得到了一些超出我最小configuration的好主意。 我会投你一票,但我还不能。
这里是我的“gitweb-gitolite”configuration,希望能帮助你findconfiguration中缺less的东西:
我在gitweb.conf.pl的末尾包含了我的gitweb_config.perl (如gitolite文档中提到的),如下所示:
use lib ("."); require "gitweb.conf.pl";
这里是我的gitweb.conf.pl ,改编自gitolite/contrib/gitweb/gitweb.conf :
(请注意,我有自定义path)
# -------------------------------------------- # 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/); };
正如pipe理员文档中提到的,我的.gitolite.rc文件包含:
$PROJECTS_LIST = $ENV{HOME} . "/projects.list";
,它引用与reponames.git ( $projects_list等于$gl_home/repositories )中定义的目录$projects_list相同的reponames.git存储$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};
在.gitolite.rc文件中定义.gitolite.rc :
> grep REPO_BA .gitolite* .gitolite.rc:$REPO_BASE="repositories";