How do I have to configure gitweb and gitolite so they'll work together?

后端 未结 3 752
自闭症患者
自闭症患者 2020-12-29 10:42

I am trying to make gitweb work with gitolite... but unsuccessful so far.
I am working on a RedHat Linux machine. A user called git exists.

gitolite

相关标签:
3条回答
  • 2020-12-29 10:55

    I recently set up gitolite and gitweb and found that /etc/gitweb.conf required very little configuration. What you have looks right to me. What are the permissions like on /home/git/repositories? You may find they are too restrictive. Try this out:

    $ chmod -R 775 /home/git/repositories
    

    That's what solved the issue for me, (though I imagine there's a more secure way to set up the permissions). If that works, I'd recommend just having a look into giving Apache (or whatever user account gitweb is being executed under) more fine-grained permissions over the repositories directory.

    I also have this in my .gitolite.rc:

    GIT_CONFIG_KEYS => 'gitweb\.(owner|description|category)',
    

    so that the following works in <gitolite-admin>/conf/gitolite.conf:

    config gitweb.owner         =   owner name
    config gitweb.description   =   some description
    config gitweb.category      =   some category
    
    0 讨论(0)
  • 2020-12-29 10:55

    1/ install gitolite and set it up. Then it suffices to make sure /home/git/.gitolite.rc contains uncommented parts that look like:

    %RC = (
        ...
        UMASK                           =>  0027,
        ...
        ENABLE => [
            ...
            'gitweb',
            ...
         ]
    );
    

    2/ set correctly $projectroot and $projects_list directives of /etc/gitweb.conf (to match location of projects.list file and repositories dir). Like:

    $projectroot = "/home/git/repositories";
    ...
    $projects_list = "/home/git/projects.list";
    

    3/ Make sure current repository files are also readable by webserver user. These examples are from debian based systems, so YMMV:

    sudo adduser www-data git                   # append `www-data` user to a `git` group
    sudo chmod g+r /home/git/projects.list      # make sure group members can read the `project.list`
    sudo chmod -R g+rx /home/git/repositories   # recursively set less restrictive access mode for group members
    sudo /etc/init.d/apache2 restart            # restart web server to apply these changes
    

    4/ Finally configure access for gitweb user within your /conf/gitolite.conf file of gitolite-admin repository on a client machine and apply them by committing and pushing them (the standard way). A repository we would like to see and manage via gitweb has to have the access set like this:

    repo testing                                                                    
        RW+     = @all                                                              
        R       = gitweb  # add this line to make the repo browsable using `gitweb`
    

    Note: The ... only suggests there are other configuration directives within the files. Do not put them there!

    No other chages are necessary to make gitlab visualize the gitolite repositories.

    Applies (at least) for gitolite 3.6.6 and gitweb 2.1.4

    0 讨论(0)
  • 2020-12-29 11:09

    You need to add the Gitolite contrib/gitweb.conf at the end of /etc/gitweb_config.perl.
    In other words, you need to call a Gitolite function from your gitweb.conf perl file, otherwise the integration GitWeb-Gitolite will never work.

    # check for (at least) "R" permission
        my ($perm, $creator) = &repo_rights($repo);
        return ($perm =~ /R/);
    

    (here repo_rights is a method from gitolite.pm)

    Check the section "helping with gitweb".

    The last lines you need to add at then end of gitweb_config.perl are:

    use lib (".");
    require "gitweb.conf.pl";
    

    That way, you will avoid any "500 - Internal Server Error syntax error at /etc/gitweb.conf" error message.

    If you don't have a gitweb_config.perl in which you declare gitweb.conf.pl, but directly "gitweb.conf.pl", then add "use lib (".");" as the first line of that file.

    0 讨论(0)
提交回复
热议问题