This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

1. Setting up a local Cgit environment

This tutorial will guide you through the steps for setting up a local installation of Cgit. The requirements:

  1. Apache on Ubuntu / Debian (httpd on RHEL / Fedora / CentOS)
  2. Cgit, cloneable at http://git.zx2c4.com/cgit or installable directly from your distribution package manager. Instructions for that are down here.

  3. Some example Git repositories

The steps:

  1. Install apache with either yum install httpd or apt-get install apache2

  2. Download the CSS files for git.gnome.org from cgit-css-gnome.tar.gz.

  3. Configure a VirtualHost at either /etc/httpd/sites.d/my-vhost.conf or /etc/apache2/sites-available/my-vhost-conf. (make sure to set up a symlink if you are on Debian / Ubuntu from /etc/apache2/sites-available/my-vhost.conf to /etc/apache2/sites-available/my-vhost.conf

  4. Install Cgit with yum install cgit or apt-get install cgit.

  5. Configure the relevant configuration file at /etc/cgitrc. An example:

  6. Restart Apache / HTTPD to grab the latest changes.
  7. Get yourself into http://localhost/git

Examples files:

my-vhost.conf:

<VirtualHost *:80>
    ServerName git.gnome.org

    CustomLog  /var/log/httpd/access_log  combined env=!dontlog
    ErrorLog  /var/log/httpd/error_log

    <Directory /srv/http/cgit>
        Options +ExecCGI
    </Directory>

    Alias /browse/cgit.css /srv/http/cgit/cgit.css
    Alias /browse/cgit.png /srv/http/cgit/cgit.png
    Alias /browse/applications-development.png /srv/http/cgit/applications-development.png
    Alias /browse/cgit-gnome.css /srv/http/cgit/cgit-gnome.css
    Alias /browse/gnome-style.css /srv/http/cgit/gnome-style.css
    Alias /browse/gnome-layout.css /srv/http/cgit/gnome-layout.css
    Alias /browse /srv/http/cgit/cgit.cgi
</VirtualHost>

/etc/cgitrc:

# GNOME customization
css=/browse/cgit-gnome.css
# No logo, GNOME header is already logified
logo=

# Has GNOME header and footer
header=/srv/http/cgit/gnome.header
footer=/srv/http/cgit/gnome.footer

favicon=http://www-old.gnome.org/img/logo/foot-16.png

commit-filter=/usr/local/bin/cgit-commit-links.sh
source-filter=/usr/local/bin/cgit-syntax-highlighting.sh

# Looks funny if we don't have something here, maybe could be improved
root-title=All Projects
# Looks fine without a description though
root-desc=

clone-prefix=git://git.gnome.org http://git.gnome.org/browse ssh://USERNAME@git.gnome.org/git

# Put all the modules on the first page of the project listing without pagination
max-repo-count=655

# List the number of files and lines changed in the log
enable-log-filecount=1
enable-log-linecount=1

# Allow download of tar.gz, tar.bz2 and zip-files
snapshots=tar.gz zip

mimetype.html=text/html
mimetype.jpg=image/jpeg
mimetype.jpeg=image/jpeg
mimetype.pdf=application/pdf
mimetype.png=image/png
mimetype.svg=image/svg+xml
mimetype.ogv=video/ogg

#cache-size=1000
# All these cache settings influence the Expires header!
cache-dynamic-ttl=60
cache-static-ttl=44640
cache-root-ttl=6
# Also used for the 'plain' / blob interface.
cache-repo-ttl=120

2024-10-23 11:10