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 on Mac OsX, trying to host my own git server. I've got gitolite running perfectly.

However, I have a folder called "git" in my Sites directory, such that visiting http://git.example.com points to that directory.

How can I get Gitweb's document root to point to my gitolite "repositories" folder in /Users/me/repositories/?

share|improve this question

2 Answers 2

You need to add a gitweb.conf.pl file (like this one) which:

  • will be called by gitweb (if that file exists and defines a export_auth_hook sub, gitweb.cgi calls it)
  • will specify where the git repos are
  • will call gitolite

That would include:

$ENV{GL_REPO_BASE_ABS} = "$ENV{HOME}/repositories";
$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 = &access( $repo, $user, 'R', 'any' );
    my $res = $ret !~ /DENIED/;
    return ($ret !~ /DENIED/);
};

With access() being a function of gitolite/src/lib/Gitolite/Conf/Load.pm.

Your httpd.conf would then call the gitweb.cgi script like in this one.

share|improve this answer
    
I'm still having the mismatch between the listing at git.jshawl.com and the the "txt" version at git.jshawl.com/?a=project_index I pasted this into a file /etc/gitweb.conf.pl –  jessh Aug 20 '12 at 14:46
    
@jessh what version of Git are you using? –  VonC Aug 20 '12 at 18:51
    
the most recent version git version 1.7.7.5 (Apple Git-26) –  jessh Aug 20 '12 at 20:30
1  
@jessh ok, just checkng if the gitweb was a recent one (and it isn't really, but I don't know if that matters). Does your project.list includes all repos, including gitolite-admin? –  VonC Aug 20 '12 at 21:03
1  
@jessh It should be generated automatically by the gitolite installation. Another thing, the script automatically called by gitweb (if it exists) is actually gitweb_config.perl (github.com/VonC/compileEverything/blob/master/gitweb/…), which in turns calls my custom gitweb.conf.pl. –  VonC Aug 21 '12 at 4:00

Since I was missing my project.list, I created it myself. Then I chmod -r 755'ed the whole repositories directory. Working now!

share|improve this answer
1  
So you didn't need the gitweb_conf.perl addon? –  VonC Aug 22 '12 at 18:13
1  
I didn't. Bizarre right? –  jessh Aug 23 '12 at 2:01
    
So, is it really working? Meaning, if you declare in gitolite a repo as not visible for a certain user, will that user actually see or not said repo through your gitweb? –  VonC Aug 23 '12 at 6:08
1  
It seems similar to stackoverflow.com/questions/12041578/… –  VonC Aug 24 '12 at 12:21
    
@VonC: A mystery to me - similar thing here: The projects.list exists, is accessible, and so the gitweb page shows "no such projects" (but not the 404 msg). At the same time, clicking the <txt> link in the lower right displays a projects.list with the two repos I selected to be public. Now I'm hesitant to install additional perl scripts and an apache redirect rule if it turns out that that's not really required. –  cfi Feb 11 '13 at 11:13

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.