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

16,531

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
Share:
16,531

Related videos on Youtube

Jee
Author by

Jee

Updated on June 14, 2022

Comments

  • Jee
    Jee about 2 years

    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 is installed under: /home/git
    Repository location: /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

      myrepo1.git
      myrepo2.git 
      
    • /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.

    Web URL: http://MyHostName/git
    This gives a 404 error saying - No repositories found.

  • Jee
    Jee almost 13 years
    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
    Jee almost 13 years
    I am doing something very obviously wrong. Is my gitweb.conf, projects.list, .gitolite.rc setup correctly? Error message clearly says: No Projects Found.
  • VonC
    VonC almost 13 years
    @Jee: At the end of /etc/gitweb.conf, you ned to copy all the lines of github.com/sitaramc/gitolite/blob/pu/contrib/gitweb/gitweb.c‌​onf (and change the value of lines 21, 23, ... if you have used different paths in your Gitolite installation)
  • Jee
    Jee almost 13 years
    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 "
  • VonC
    VonC almost 13 years
    @Jee: I have updated my answer to avoid any "syntax error" message.
  • Jee
    Jee almost 13 years
    I changed my dir permissions on git home dir, recursively to 755 (tried many other lesser privileges but those did not seem to work). That seems to have resolved No Projects Found problem on web. I did not add contents of gitolite - contrib/gitweb.conf to /etc/gitweb.conf. Now i am able to browse the repositories on the web.
  • VonC
    VonC almost 13 years
    @Jee: excellent, but I don't think your browsing benefit from Gitolite permission management. Anyone should be able to browse your repo, even if they shouldn't according to the gitolite conf file.
  • Hamish Downer
    Hamish Downer about 12 years
    To be slightly more secure you could add the apache/www-data user to the gitolite group usermod -a -G gitolite apache and then do chmod -R 750 /home/git/repositories along with setting the gitolite variable $REPO_UMASK = 0027;
  • Jason L
    Jason L almost 11 years
    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
  • Timo
    Timo over 3 years
    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.