I’ve been using a Digital Ocean droplet to run git, gitolite and GitList, to host my private git repos for some time, but I recently decided to switch to a Cubieboard, because it’s more fun and an easy way to save about $10/mo. In this post I’ll show you the steps I took to install git and gitolite on the Cubieboard, using Cubian X.
- Install git and gitolite:
sudo apt-get install git gitolite
- Add an user to handle gitolite:
sudo adduser --system --shell /bin/bash --group --disabled-password --home /home/git git
The code above creates the git user, without password, so direct logins are not possible.
- Switch to the git user:
sudo su git
- Change directory:
- Generate a RSA key:
ssh-keygen -t rsa
You can safely accept the defaults. You should get something like this:
Generating public/private rsa key pair. Enter file in which to save the key (/home/git/.ssh/id_rsa): Created directory '/home/git/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/git/.ssh/id_rsa. Your public key has been saved in /home/git/.ssh/id_rsa.pub. The key fingerprint is: 4c:44:82:2e:ad:86:4e:9a:83:ef:e9:97:84:46:2d:d9 git@cubie The key's randomart image is: +--[ RSA 2048]----+ | +o | | oo* | | + o o.o | | + F o.o | | . + o *S | | + . .. . | | o o . . | | o o | | ... | +-----------------+
- Still as the git user configure gitolite:
You should get the following output:
The default settings in the rc file (/home/git/.gitolite.rc) are fine for most people but if you wish to make any changes, you can do so now. hit enter...
Press the Enter key on your keyboard then you can just save the file and exit. If you’re using nano, just press CTRL+O and then CTRL+X.
- Copy the id_rsa (not the id_rsa.pub) file from /home/git/.ssh to your local computer.
- Configure SSH access to your Cubieboard for the git user. On a Mac you would place your id_rsa file (you can rename it) in your home folder, under .ssh, and you would edit the config file under .ssh by adding something like this:
Host 192.168.0.101 Hostname 192.168.0.101 User git Port 36000 IdentityFile /Users/your-username/.ssh/cubie_id_rsa ServerAliveInterval 300
Now, if you do ssh email@example.com you should get something like:
hello id_rsa, this is gitolite 2.3-1 (Debian) running on git 188.8.131.52 the gitolite config gives you the following access: R W gitolite-admin @R_ @W_ testing Connection to 192.168.0.101 closed.
- You can now clone the gitolite-admin repository (which is used to change the gitolite configuration) from your Cubieboard to your local computer:
git clone firstname.lastname@example.org:gitolite-admin.git
git and gitolite installation is now complete. In my next post I’ll show you how to actually configure gitolite, how to add new users and new repositories.