Introduction
Gitolite (http://gitolite.com/gitolite/index.html) allows you to host your own git repositories, with easy access control for many users. The following describes the steps to install it on Ubuntu 18.04 LTS. An example vagrant/ansible installation can be found here.
Step 1: Install packages
Ubuntu is already bundled with gitolite, so we just need to install the package. This doesn’t create any repositotories, it merely installs the code.
sudo apt install git-core gitolite3
Step 2: Create users and groups
Now we need to create th user and group that will run and own the gitolite repositories. It is this user that will be used to access the repositories remotely. This also implies you could have multiple users if you want to host different clusters; each cluster would have completely different user permissions and access.
Make sure there is sufficient disk space to host the repositories.
sudo adduser git
Step 3: Generate SSH keypair for the Administrator
Gitolite uses SSH to handle remote communications, and also uses SSH certificates for authentication. We need to generate a key pair for the administrator in advance of initialising the cluster. Keep the private key of this keypair safe, without it the cluster cannot be administered (easily).
sudo su - git
ssh-keygen -t rsa -f admin
Step 4: Initialise the cluster
We can now initialise the cluster. We will initialise the cluster in the home directory of the “git” user, so best make sure that has sufficient disk space.
sudo su - git
gitolite setup --pubkey admin
Step 5: Configure the cluster
At this point the cluster is ready; new repositories can be created and access can be granted to more than just the administrator. Gitolite is administered by cloning its gitolite-admin repository, updating the configuration and committing & pushing the changes back.
Copy the private key for the administrator to another computer and make sure the file permissions of the private key are appropriate (i.e. chmod 0600 admin
). Then clone the admin repository.
git clone git@mygitserver.com:gitolite-admin
From there you can pickup from the main documentation: