Alestic Git Server (EC2)
The Alestic Git Server makes it simple to start a new, centralized Git server with an unlimited number of private Git repositories under your control running on an Amazon EC2 instance. The access control for the Git repositories is performed using gitolite, a powerful tool for managing who can access what repositories (and more).
Benefits
There are a number of popular, commercial services that offer Git repository hosting. These services are fantastic for a variety of uses, especially if you wish to host a public, open source project, or a limited number of private repositories for a limited number of users with a limited amount of disk storage.
Running your own Git server with an EC2 instance lets you host an unlimited number of private repositories with an unlimited number of users, and you have control over the repository data as it’s running on your own, private server.
The Alestic Git Server puts together existing, popular, well tested. open source software in a clean configuration with appropriate hooks for running in an Amazon EC2 environment, taking some of the pain and confusion out of the job of setting up your centralized Git server.
The focus of the project at this point is to provide a clean interface for accessing and managing Git repositories. There are no project management, bug tracking, social networking, or other fancy features included. Just Git with access managed through gitolite.
Software
The Alestic Git Server combines the following technologies in a reasonable, best-practices configuration:
Git v1.7.9.5
gitolite v3.4-1 (master branch)
Ubuntu 12.04 LTS Precise
Amazon EC2 EBS boot instance
The Ubuntu operating system has all software packages updated as of the AMI build date.
The Git software manages the repositories on the server, as you would expect.
The gitolite software manages and controls the access users have to the git repositories. There is a learning curve here, but once you get the hang of it, gitolite provides great security (through standard ssh controls) and flexibility with how you share repository access and even delegate access control.
Your Responsibilities
Even though the above software is initially installed and configured for you, it is still your responsibility to understand and use each of these components in an appropriate manner. For example, you will need to understand:
How to use Git.
How to use gitolite to set up repository users (by adding their public ssh keys to the
gitolite-adminrepository) and how to give them access to Git repositories (with the gitolite configuration file in thegitolite-adminrepository).What it means to store valuable information on an EC2 instance and how to manage the risks.
For example, on this last point, you should understand that an EC2 instance and even an EBS volume can fail at any time. If you care about your data you should set up regular EBS snapshots and/or off-site backups of your git repositories.
There is a lot of documentation for each of these components as well as online support if you run into issues not covered by the documentation.
Preparation
When you run an Alestic Git Server (or any EC2 instance) you specify an ssh keypair name to be used with the new instance.
This guide strongly recommends and assumes that you have uploaded your own personal, default ssh key to Amazon EC2 using a name that matches your local username. This is a one-time process that can be performed by following the steps here:
Normally, this ssh key gives you access to the instance using ssh. With the Alestic Git Server, this ssh key also gives you access to the initial administrative repository for gitolite, so upload the key you will be using to administer the gitolite configuration adding users and controling their repository access.
Running Alestic Git Server
Run an instance of the Alestic Git Server AMI, specifying your ssh key that you uploaded from the Preparation step above. Your default security group should allow ssh access on port 22.
ec2-run-instances --key $USER --instance-type t1.micro ami-4c6df225
Wait until the instance is running and make a note of the IP address. At this point, you may even want to assign an Elastic IP address and set up a DNS hostname to resolve to it.
Cloning `gitolite-admin`
The first step you perform after starting an Alestic Git Server is to check out the gitolite-admin repository so that you can add users and manage their repository access.
git clone git@$host:gitolite-admin
where $host is either the IP address of the new EC2 instance or a DNS hostname that you have assigned to it.
When you look at the gitolite-admin/conf/gitolite.conf file, you will see that there is already one user (you) who has access to the gitolite-admin repository. Your ssh public key that you uploaded to EC2 in the Preparation step above will already have been copied into the gitolite-admin/keydir directory with a name like $USER.pub.
If you are going through the gitolite documentation then you are now basically done with the “install, setup, and clone” and are ready to continue on with adding users and repositories.
Implementation Notes
Gitolite is installed in the under the
gituser’s home directory.On first boot, the
gitolite setupcommand is run with the user’s public ssh key as provided by Amazon EC2 to the instance.The base of the AMI is based on the standard Ubuntu image built by Canonical, with all software packages updated as of the time the Alestic Git Server AMI was published.
As with standard Ubuntu AMIs published by Canonical, direct login to the instance is performed through ssh to the
ubuntuuser. This can be used to tweak gitolite settings, to perform recovery from mistakes in gitolite-admin configuration, and to upgrade Ubuntu and gitolite software packages.
The Alestic Git Server AMIs are built with the open source software published here:
Upgrading
TBD: How to upgrade Ubuntu packages.
TBD: How to upgrade gitolite software.
License
The Alestic Git Server software is released under open source licenses. Read more…
Support
There is a public Google group for discussion, announcements, and support of the Alestic Git Server:
Support for the Alestic Git Server covers the basics of getting the server running. Support for issues specific to Git, gitolite, Ubuntu, EC2, et. al. can be directed to the many great online resources for these fine products.
History
20130311
- Upgraded to gitolite v3.4-1 (master branch)
- Latest Amazon provided pv AKI (kernel)
- Available on all AWS Marketplace regions
20120426
- Upgraded to Ubuntu 12.04 Precise
- Upgraded to Git v1.7.9.5
- Upgraded to gitolite v3.0-14 (master branch)
- All Ubuntu packages updated to latest versions.
20120418
- Upgraded to Ubuntu 11.10 Oneiric
- Upgraded to Git v1.7.5.4
- Upgraded to gitolite g3 v0.02-43 (master branch)
- All Ubuntu packages updated to latest versions.
20110611
- Upgraded to Ubuntu 10.04 Natty
- Upgraded to gitolite v2.0.1-0 (master branch)
- All Ubuntu packages updated to latest versions.
20110322
- Ubuntu 9.10 Maverick
- Git v1.7.1
- gitolite v2.0-4 (master branch)
Competition
If you end up deciding not to run your own Git server, here are some Git service providers with support for private repositories. These links go directly to the pricing pages for comparison.
- Assembla
- Beanstalk
- Bitbucket
Codaset- Codebase
CipherHive- GitHub
- GitFarm
- InDefero
- ProjectLocker
- RepositoryHosting
- SourceForge
- Unfuddle
- XP-Dev


Follow Eric Hammond on Twitter
Leave a comment