Gitolite is the program that’s currently the most streamlined of all for managing your own Git hosting.
In this program, everything happens on the command line—no web interface and of course no ticket system, wiki, or similar features. For Gitolite, the software requirements are minimal:
Since the system doesn’t use a database or application server, the hardware requirements are also quite low: As long as the SSH server is running and access to permanent storage is snappy, you won’t have any performance issues for your private repositories. For this reason, you can also use mini servers (like a Raspberry Pi) as Gitolite servers.
Unlike the Git hosting programs presented so far, Gitolite handles remote access to Git repositories exclusively via SSH. All SSH access occurs via a user account on the Linux system, and this account manages the rights for the projects. The other hosts we’ve described do the same. You can recognize this by the address of the remote Git repository: Using the address git@gitolite.git-compendium.info:gitolite-first, you can connect as user git to the server gitolite.git-compendium.info and use the repository gitolite-first.
For the most straightforward installation, re-create this user on your server and let Gitolite initialize the SSH settings. If you’re familiar with Docker, we recommend looking at the repository at https://github.com/git-compendium/gitolite-docker, where you’ll find a Docker setup that starts the Gitolite server with a command. For example, on an Ubuntu or Debian server, you can perform the manual setup with the following commands:
sudo useradd -m git
sudo su - git
git clone https://github.com/sitaramc/gitolite
mkdir /home/git/bin
/home/git/gitolite/install -ln
With this step, you’re almost done with the installation. What’s still missing is the administrator user for your Git repositories. Now, you must generate a SSH key on your workstation/laptop (or use an existing SSH key).
ssh-keygen -f ~/.ssh/gitoliteroot -N ''
scp ~/.ssh/gitoliteroot.pub gitolite.git-compendium.info:/tmp
Then, copy the public part of the key to the server and complete the installation (still as user git), as shown in the following example:
/home/git/bin/gitolite setup -pk /tmp/gitoliteroot.pub
Initialized empty Git repository in
/home/git/repositories/gitolite-admin.git/
Initialized empty Git repository in
/home/git/repositories/testing.git/
WARNING: /home/git/.ssh missing; creating a new one
(this is normal on a brand new install)
WARNING: /home/git/.ssh/authorized_keys missing; creating a ...
(this is normal on a brand new install)
The Gitolite server is now ready. As shown in the output earlier, two Git repositories have been created: gitolite-admin and testing. Creating users or new Git repositories can be performed by modifying the gitolite-admin repository. You must clone the repository on your laptop or workstation where you previously generated the SSH keys:
git clone git@gitolite.git-compendium.info:gitolite-admin
Cloning into 'gitolite-admin'...
...
The new directory contains the conf and keydir folders. The latter contains the SSH public key for gitoliteroot, which you imported during setup.
tree --charset=ascii
.
|-- conf
| `-- gitolite.conf
`-- keydir
`-- gitoliteroot.pub
To create new users, you must simply copy their public SSH keys to the keydir folder. Note that the name of the file corresponds to the user name. To create new Git repositories, edit the conf/gitolite.conf file and add a new repo entry:
repo gitolite-first
RW+ = gitoliteroot
This step creates the gitolite-first repository, and the user gitoliteroot now has read and write permissions. Still, you must commit and push these changes:
git commit -a -m "add gitolite-first repo"
[master 0fcc024] add gitolite-first repo
1 file changed, 3 insertions(+)
git push
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 393 bytes | 393.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0)
remote: Initialized empty Git repository in
/home/git/repositories/gitolite-first.git/
To gitolite:gitolite-admin
7b33ac2..bb8b85f master -> master
In the output of git push, notice that Gitolite has created a new Git repository for you. In the current version of Gitolite, a branch named master must be used. This name is referenced in many places in the Perl source code of the program.
Although both authors are quite fond of the command line, we still found Gitolite to be very ascetic. The web interfaces of GitHub, GitLab, or Gitea provide much more comfortable interfaces.
Editor’s note: This post has been adapted from a section of the book Git: Project Management for Developers and DevOps Teams by Bernd Öggl and Michael Kofler. Bernd is an experienced system administrator and web developer. Since 2001 he has been creating websites for customers, implementing individual development projects, and passing on his knowledge at conferences and in publications. Michael studied telematics at Graz University of Technology and is one of the most successful German-language IT specialist authors. In addition to Linux, his areas of expertise include IT security, Python, Swift, Java, and the Raspberry Pi. He is a developer, advises companies, and works as a lecturer.
This blog post was originally published 1/2025.