1

I'm several git repositories accessible to different users. I want to allow the users to browse all repos he or she has at least READ access to.

To achieve this I have the following gitweb config:

$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/);
};

and the test_git_access_right script:

#!/bin/sh
su - git -c "gitolite access $*"

My problem is, that the test_git_acces_right script is not executed (tested by embedding an echo). So what am I doing wrong here?

Thanks in advance for any help!

  • See my setup for gitweb and gitolite here: https://github.com/VonC/compileEverything/tree/master/gitweb : the https://github.com/VonC/compileEverything/blob/master/gitweb/gitweb_config.perl is executed if found. I call from there https://github.com/VonC/compileEverything/blob/master/gitweb/gitweb.conf.pl.tpl – VonC Dec 30 '12 at 21:52
  • Thanks. Actually I've already seen your setup but since I'm not really comfortable in perl I was hoping for an easier solution. I'll have another look. – Martin Schulze Dec 30 '12 at 21:54
  • Well... all GitWeb is in perl, so the plugin (which is expected by gitweb itself) which is `gitweb_config.perl` should call a perl script. – VonC Dec 30 '12 at 22:02

0 Answers0