Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
    
See my setup for gitweb and gitolite here: github.com/VonC/compileEverything/tree/master/gitweb : the github.com/VonC/compileEverything/blob/master/gitweb/… is executed if found. I call from there github.com/VonC/compileEverything/blob/master/gitweb/… –  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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.