Git Based Development Networks with Girocco on Debian 5 (Lenny)

Updated by Linode Written by Linode

Contribute on GitHub

Report an Issue | View File | Edit File

This guide has been deprecated and is no longer being maintained.

Girocco is the underlying engine created to power one of the first public git hosting services at, and it allows users an easy to use web-based interface to create and view git repositories. Perhaps most excitingly, Girocco provides the ability to seamlessly “fork” an existing repository on the site and publish those changes without needing “push” access to the original repository, thus enabling a wide rage of distributed workflows and collaborative experiences.

Before beginning this guide, we assume that you’ve completed the getting started guide. If you’re new to using git, you may also find our introduction to git a helpful prerequisite. If you’re new to Linux server administration, you may be interested in our introduction to Linux concepts guide, beginner’s guide and administration basics guide.

Install Prerequisites

Before beginning the installation of Girocco, issue the following commands to ensure that your system is up to date and that you’ve installed the latest version of all software packages:

apt-get update
apt-get upgrade

Now issue the following command to install the required prerequisite software:

apt-get install git-core build-essential netcat-openbsd apache2 wget libwww-perl libjson-perl librpc-xml-perl

The above command installs the Apache HTTP Server, and this guide depends upon running Apache. For more information regarding the setup and configuration of Apache, consider our series of Apache guides.

This guide does not include explicit instructions for downloading and installing a local send-only mail server, which you will need to do for some operations such as sending password recovery tokens. If you do not have a local MTA installed or configured already, begin by issuing the following command:

apt-get install mailx

This will install the MTA “Exim.” You can configure this MTA by issuing the following command and following the steps outlined in the Exim send-only MTA guide guide:

dpkg-reconfigure exim4-config

We are now ready to proceed with the installation and configuration of Girocco.

Install Girocco

Begin by issuing the following commands to download the source code for Girocco:

cd /opt/
git clone git://
cd /opt/girocco/
git submodule update --init

Configure Girocco

Edit the configuration file for Girocco at /opt/girocco/Girocco/ and tailor the variables set therein. It might be prudent to create a backup of the “base” Girocco configuration, by issuing the following command:

cp /opt/girocco/Girocco/ /opt/girocco/Girocco/

Most of the default values in the file can be left as the default. You will want to customize the ## Basic Settings at the very beginning of the file, particularly the name, title, and admin variables. For the purposes of this guide we’ve modified the ## Paths section as follows:

 1 2 3 4 5 6 7 8 9101112131415161718192021
## Paths

# Path where the main chunk of Girocco files will be installed
# This will get COMPLETELY OVERWRITTEN by each make install!!!
our $basedir = '/srv/repo/bin';

# The repository collection
our $reporoot = "/srv/repo/git";

# The chroot for ssh pushing; location for project database and other run-time
# data even in non-chroot setups
our $chroot = "/srv/repo/data";

# The gitweb files web directory (corresponds to $gitwebfiles)
our $webroot = "/srv/repo/public_html";

# The CGI-enabled web directory (corresponds to $gitweburl and $webadmurl)
our $cgiroot = "/srv/repo/public_html";

# A web-accessible symlink to $reporoot (corresponds to $httppullurl, can be undef)
our $webreporoot = "/srv/repo/public_html/r";

Similarly, edit the URL addresses section of the guide in accordance with the needs of your deployment as follows:

 1 2 3 4 5 6 7 8 910111213141516171819202122232425262728
## URL addresses

# URL of the gitweb.cgi script (must be in pathinfo mode)
our $gitweburl = "";

# URL of the extra gitweb files (CSS, .js files, images, ...)
our $gitwebfiles = "";

# URL of the Girocco CGI web admin interface (Girocco cgi/ subdirectory)
our $webadmurl = "";

# URL of the Girocco CGI html templater (Girocco cgi/html.cgi)
our $htmlurl = "";

# HTTP URL of the repository collection (undef if N/A)
our $httppullurl = "";

# Git URL of the repository collection (undef if N/A)
# (You need to set up git-daemon on your system, and Girocco will not
# do this particular thing for you.)
our $gitpullurl = "git://";

# Pushy URL of the repository collection (undef if N/A)
our $pushurl = "ssh://";

# URL of gitweb of this Girocco instance (set to undef if you're not nice
# to the community)
our $giroccourl = "$Girocco::Config::gitweburl/girocco.git";

Carefully consider the remaining configuration options in /opt/girocco/Girocco/ The default settings are sufficient, but you may wish to modify configuration options to suit the needs of your deployment. When your configuration file is suitably configured for your needs, we recommend creating a backup of this file by issuing the following command:

cp /opt/girocco/Girocco/ /opt/

Configure System Files and Accounts

Issue the following commands to create the required directories and symbolic links:

mkdir -p /srv/repo/data  /srv/repo/public_html/ /srv/repo/git/ /srv/repo/bin/ /root/repo /srv/repo/git/mob.git/
mkdir -p /srv/www/
ln -s /srv/repo/git /srv/repo/public_html/r
ln -s /srv/repo/git /srv/git
ln -s /srv/repo/public_html /srv/www/

You will need to create the repo user and account to isolate privileges for the repository users. Issue the following command:

adduser --system --no-create-home --disabled-login --disabled-password --group repo

Configure Helper Scripts

Issue the following command to copy the scripts and to the /root/repo directory:

cp /opt/girocco/jobs/ /root/repo
cp /opt/girocco/jobs/ /root/repo

These scripts are configured separately from the file above. However, you must ensure that the settings correspond exactly. The following example contains the required modifications for our Girocco configuration:

 1 2 3 4 5 6 7 8 91011
## and does not reuse Girocco::Config settings.

## Girocco::Config::reporoot
## Girocco::Config::chroot
## Girocco::Config::mirror_user
## Directory with this script and; WARNING: COPY THEM OVER to ~root!
## Otherwise, the owner of these scripts can execute anything as root.

Build and Install Girocco

Issue the following commands to build and install the Girocco engine:

cd /opt/girocco/
make install

Upgrading Girocco

In most cases, upgrading Girocco is as simple as running a sequence of commands to download new revisions of the software and rebuild the software. Those commands resemble the following:

cd /opt/girocco/
git pull
git submodule update
make install

However, it is prudent to ensure that additional upstream modifications to the girocco/Girocco/ will not affect your Girocco instance. If the girocco/Girocco/ file is modified during the git pull operation, be sure to inspect the changes very carefully. If the git pull command above fails with warnings regarding the file, remove the configuration file, complete the pull, and then issue the following command to compare your configuration file with the new configuration file:

diff /opt/girocco/Girocco/ /opt/

Modify your configuration file sufficiently with the new configuration options provided by the upstream and complete the rebuild process.

Run Regular Tasks

To ensure complete functionality of the Girocco system, we need to run the and scripts as daemons to perform necessary system maintenance. Use or modify the following init script to control the daemon operations:

cd /opt/
wget -O
cp /opt/ /etc/init.d/repod
chmod +x /etc/init.d/repod
/usr/sbin/update-rc.d -f repod defaults

Issue the following commands to start and stop the daemons in turn:

/etc/init.d/repod start
/etc/init.d/repod stop

From this point forward, these daemons will start following reboot cycles and can be controlled with the init script.

You will also want to create a root user cron job to regularly run the /root/repo/ script as root. Issue the following command as root:

crontab -e

Then insert the following line:

root crontab
*/5 * * * * /usr/bin/nice -n 18 /root/repo/

This configures the script to run once every 5 minutes. Monitor the length of time it takes to run the script, and the frequency of pushes, and adjust the frequency based on this data.

Additionally issue the following command to create a repo user cronjob:

crontab -u repo -e

Then insert the following line:

repo crontab
*/5 * * * * /usr/bin/nice -n 18 /srv/repo/bin/jobd/ -q --all-once

This configures the script to run once every 5 minutes. Monitor the length of time it takes to run the script, note any error messages this produces, and modify the frequency in response to this. You may also run the command /srv/repo/bin/jobd/ in an interactive terminal as needed. Some tasks related to mirroring will not appear to succeed unless jobd is running constantly or runs at the appropriate time. You may want to run jobd in a GNU Screen session, by issuing the following command as the repo user:

while ( true ); do /srv/repo/bin/jobd/; sleep 5; done

Additionally, add the following two lines as instructed by the installation script to your /etc/rc.local script to ensure that a chroot set up to isolate functions following reboot cycles:

mount --bind /srv/repo/git /srv/repo/data/srv/git mount --bind /proc /srv/repo/data/proc

Configure Web Server

For the purpose of this document we will set up the repository hosting service under the virtual host for the domain You will need to ensure that DNS is configured for this domain. Additionally, ensure that the rewrite module is enabled by issuing the following commands:

a2enmod rewrite
/etc/init.d/apache2 restart

Furthermore, ensure that the paths specified in this file match the paths that you specified in the “Paths” section of the /opt/girocco/Girocco/ file. Consider the following:

Apache Virtual Host Configuration
 1 2 3 4 5 6 7 8 91011121314151617181920

        ErrorLog /srv/www/
        CustomLog /srv/www/ combined

        DocumentRoot /srv/repo/public_html
        <Directory /srv/repo/public_html>
                Options Indexes FollowSymLinks MultiViews ExecCGI
                AllowOverride All
                Order allow,deny
                allow from all
                DirectoryIndex gitweb.cgi
                AddHandler cgi-script .cgi

        ScriptAlias /w /srv/repo/public_html/gitweb.cgi
        ScriptAlias /h /srv/repo/public_html/html.cgi

Congratulations! You may now visit to begin using your Girocco repository hosting system.

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

See Also

comments powered by Disqus

This guide is published under a CC BY-ND 4.0 license.