我有几个 git 存储库可供不同用户访问。我想允许用户浏览他或她至少具有读取权限的所有存储库。
为了实现这一点,我有以下 gitweb 配置:
$projectroot = '/var/lib/gitolite/repositories/';
$site_name = "my Git Repos";
$fallback_encoding = 'utf-8';
$projects_list = '/var/lib/gitolite/projects.list';
$strict_export = 1;
$export_auth_hook = sub {
my $repo = shift;
my $user = $ENV{GL_USER};
# 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 $ret = `/usr/local/bin/test_git_access_right $repo $user`;
my $res = $ret !~ /DENIED/;
return ($ret !~ /DENIED/);
};
和 test_git_access_right 脚本:
#!/bin/sh
su - git -c "gitolite access $*"
我的问题是,test_git_acces_right 脚本未执行(通过嵌入 echo 进行测试)。那么我在这里做错了什么?
提前感谢你的帮助!