From ArchWiki
Revision as of 08:51, 25 April 2012 by Fengchao (Talk | contribs) (Re category to version control system.)

Jump to: navigation, search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Cgit is an attempt to create a fast web interface for the git scm, using a builtin cache to decrease server io-pressure.


Installing cgit is rather simple as it's available in the Community repository:

# pacman -S cgit

In order to actually use cgit you will of course also need to have some webserver installed on your system, like for example Apache.



You may add the following either to the end of your /etc/httpd/conf/httpd.conf file or place it in a separate file inside the /etc/httpd/conf/extra/ directory.

# cgit configuration for apache

ScriptAlias /cgit/ "/usr/lib/cgit/cgit.cgi/"
Alias /cgit-css "/usr/share/webapps/cgit/"
<Directory "/usr/share/webapps/cgit/">
   AllowOverride None
   Options None
   Order allow,deny
   Allow from all
<Directory "/usr/lib/cgit/">
   AllowOverride None
   Options ExecCGI FollowSymlinks
   Order allow,deny
   Allow from all


Information for Lighttpd and cgit is scarse... The following configuration will let you access cgit through with redirecting to it. It's not perfect (for example you'll see "cgit.cgi" in all repos' url) but works.

Create the file /etc/lighttpd/conf.d/cgit.conf:

server.modules += ("mod_redirect",
                  "mod_rewrite" )
var.webapps  = "/usr/share/webapps/"
$HTTP["url"] =~ "^/cgit" {
    server.document-root = webapps
    server.indexfiles = ("cgit.cgi")
    cgi.assign = ("cgit.cgi" => "")
    mimetype.assign = ( ".css" => "text/css" )
url.redirect = (
    "^/git/(.*)$" => "/cgit/cgit.cgi/$1",

Just include this file in /etc/lighttpd/lighttpd.conf:

include "conf.d/cgit.conf"

and restart lighttpd.

Adding repositories

Before you can start adding repositories you will first have to create the basic cgit configuration file at /etc/cgitrc. You should at least specify the Stylesheet:

# cgit config


Now you can add your repos:

# List of repositories.
# This list could be kept in a different file (e.g. '/etc/cgitrepos')
# and included like this:
#   include=/etc/cgitrepos

repo.desc=This is my git repository

repo.desc=That's my other git repository

If you prefer not having to manually specify each repository it's also possible to configure cgit to search for them:


For detailed documentation about the available settings in this configuration file, please see the manage (`man cgitrc`).

Gitosis Integration

If you want to integrate with gitosis you will have to run two commands to give apache permission to look though the folder.

# chgrp http /srv/gitosis
# chmod a+rx /srv/gitosis