¿Cómo tengo que configurar gitweb y gitolite para que funcionen juntos?

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 existe.

gitolite is installed under: /home/git
Ubicación del repositorio: /home/git/repositories

Please note that, gitweb was working fine with plain vanilla git. Now i am trying to make it work with gitolite.

Here are what my files look like:

  • /etc/gitweb.conf

    $projectroot = "/home/git/repositories";
    @git_base_url_list = qw(ssh://[MyHostName]/home/git/projects.list);
    $projects_list = "/home/git/projects.list"
  • /home/git/projects.list

  • /home/git/.gitolite.rc:

    $PROJECTS_LIST = $ENV{HOME} . "/projects.list";
    $GL_GITCONFIG_KEYS = "gitweb.url receive.denyNonFastforwards receive.denyDeletes";

What configuration have I missed? I have not made any changes to Apache.

URL web: http://MyHostName/git
This gives a 404 error saying - No se encontraron repositorios.

preguntado el 27 de agosto de 11 a las 17:08

3 Respuestas

I recently set up gitolite and gitweb and found that /etc/gitweb.conf son requeridos 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.

Yo tambien tengo esto en mi .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

contestado el 30 de mayo de 12 a las 09:05

To be slightly more secure you could add the apache/www-data user to the gitolite group usermod -a -G gitolite apache y luego haz chmod -R 750 /home/git/repositories along with setting the gitolite variable $REPO_UMASK = 0027; - Hamish Downer

The $REPO_UMASK setting was particularly useful for me. chmod-ing the repositories directory works until the next time you update a repo and then permissions get reset to 700 on one of the files. Notice that the docs say the UMASK setting in gitolite is critical if you want to run gitweb: gitolite.com/gitolite/g2/rc.html - Jason L

Checking your cmd chmod -R 775 /home/git/repositories: User get full access, group also and others read and execute. Why so generous? I have a 500 error with curl localhost:1234 and had 755. Changing to 775 does not help. - Timo

Necesitas agregar el Gitolita contrib/gitweb.conf al final de /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/);

(aquí repo_rights es un método de gitolite.pm)

Check the section "helping with gitweb".

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

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

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

Si no tienes un 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.

Respondido 29 ago 11, 12:08

At the end of /etc/gitweb.conf exactly what line do i need to add? I tried adding this line: $/home/git/gitolite/contrib/gitweb.conf , but that gives error. I think i misunderstood. - Jee

I am doing something very obviously wrong. Is my gitweb.conf, projects.list, .gitolite.rc setup correctly? Error message clearly says: No Projects Found. - Jee

@Jee: At the end of /etc/gitweb.conf, you ned to copy todos las líneas de github.com/sitaramc/gitolite/blob/pu/contrib/gitweb/gitweb.conf (and change the value of lines 21, 23, ... if you have used different paths in your Gitolite installation) - VonC

i get following error on webpage (it appears these new lines are not understood by gitweb, it gives syntax error at very first line): 500 - Internal Server Error syntax error at /etc/gitweb.conf line 74, near "my " - Jee

@Jee: I have updated my answer to avoid any "syntax error" message. - VonC

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 => [

2/ set correctly $projectroot y $projects_list directivas de /etc/gitweb.conf (to match location of projects.list archivo y 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 archivo de 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`

Nota la ... 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 repositorios.

Applies (at least) for gitolite 3.6.6 y gitweb 2.1.4

Respondido el 19 de diciembre de 17 a las 21:12

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.