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

view plain
1sudo apt-get install git

Links I used:
git + gitolite + git-daemon + gitweb setup on Ubuntu 11.10 server
How to setup git server using gitolite in Ubuntu 11.10 Oneiric
Install Gitolite To Manage Your Git Repositories

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:

view plain
1sudo apt-get update
2sudo apt-get upgrade

Then create a tmp folder
view plain
1mkdir tmp

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.
view plain
1# local machine
2scp ~/.ssh/id_rsa.pub yourEC2server.com:/tmp/stefan.pub

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:
view plain
1scp -i ~/.ec2/yourEC2pair.pem ubuntu@ec2-999-239-176-93.compute-1.amazonaws.com:/tmp

I then installed git, gitolite and some stuff which I am not sure is strictly needed:
view plain
1sudo apt-get install git gitolite git-daemon-run git-doc

Then added my git user details and added the git user
view plain
1git config --global user.name "Stefan Richter"
2git config --global user.email "my@domain.com"
3sudo adduser --system --shell /bin/bash --gecos 'git version control' --group --disabled-password --home /home/git git

The system should reply with
view plain
1Adding system user `git' (UID 105) ...
2Adding new group `git' (GID 111) ...
3Adding new user `git' (UID 105) with group `git' ...
4Creating home directory `/home/git' ...

I then switched to the git user account, added a PATH variable and then actually ran the gitolite setup.
view plain
1sudo su git
2echo "PATH=$HOME/bin:$PATH" >
~/.bashrc
3# run gitolite setup, passing a reference to the .pub file we uploaded earlier. In my case this file was in the ubuntu/tmp folder.
4gl-setup /home/ubuntu/tmp/stefan.pub

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:
view plain
1git clone git@ec2-999-239-176-93.compute-1.amazonaws.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.

Good luck.