Don't ask me how I did it (ok, you can ask, in fact I'm going to tell you...), but somehow I now have a remote git server and gitolite for repo and user administration installed and running on Ubuntu 11.10 using an Amazon EC2 Micro instance.
I've spent all morning on this, tested it on 3 different instances (I love it how you can just throw away an EC2 instance and start again with a new one in a matter of minutes) and have kept a log of the steps which got me there. Please note that there may be errors or illogical jumps in this summary, but maybe it will be helpful nonetheless - or it may even work outright, who knows.
BEfore we get started, here are some links that helped me (but note I had to pick some steps from some links, and other steps from others...). In particular I did not clone gitolite to my local machine (as this post suggests but ended up using
sudo apt-get install git
First of all, get yourself an instance of Ubuntu (you may swap this for your preferred Linux distro). If you are in love with EC2 then head over to alestic.com and click the selection at the top of the page (I'm using the us-east region), and then pick your preferred image.
The neat thing is that if you already have an Amazon Web Services account you can launch your instance with virtually one click, very neat. I picked the Ubuntu 11.10 Oneiric EBS boot image, 64 bit.
Once booted, SSH into your instance (consult other blogs for details on this if you need help).
I then ran the following commands first:
sudo apt-get upgrade
sudo apt-get update
Then create a tmp folder
which is where you will copy your public key into. Now open another local Terminal window and copy your public key - consult the steps for generating new keys from other sources if needed.
scp ~/.ssh/id_rsa.pub yourEC2server.com:/tmp/stefan.pub
# local machine
Note that SCP is not always straight forward - I struggle with the syntax at times - and EC2 complicates it a bit. So the format may in fact look more like this:
scp -i ~/.ec2/yourEC2pair.pem email@example.com:/tmp
I then installed git, gitolite and some stuff which I am not sure is strictly needed:
sudo apt-get install git gitolite git-daemon-run git-doc
Then added my git user details and added the git user
git config --global user.email "firstname.lastname@example.org"
sudo adduser --system --shell /bin/bash --gecos 'git version control' --group --disabled-password --home /home/git git
git config --global user.name "Stefan Richter"
The system should reply with
Adding new group `git' (GID 111) ...
Adding new user `git' (UID 105) with group `git' ...
Creating home directory `/home/git' ...
Adding system user `git' (UID 105) ...
I then switched to the git user account, added a PATH variable and then actually ran the gitolite setup.
echo "PATH=$HOME/bin:$PATH" > ~/.bashrc sudo su git
# run gitolite setup, passing a reference to the .pub file we uploaded earlier. In my case this file was in the ubuntu/tmp folder.
Hit enter when asked, and quit the file that opens in VIM with :wq.
I was now able to exit the remote SSH session and could now clone a the remote gitolite-admin repository:
git clone email@example.com:gitolite-admin.git
Amazingly this worked. Please note that I may well have left out a step, or got the order slightly wrong. If needed I could create a screencast sometime (please shout), I think this would make things clearer. Make sure you read the gitolite instructions for how you add users and repos. One mistake I made was to not push my changes to the remote and then was left wondering why my new repos were not showing... Git newbie, I know.
Lastly I downloaded a trial of Tower, a GUI based git client that comes highly recommended - they even have a 25% off offer running right now.