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).


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.


The Alestic Git Server combines the following technologies in a reasonable, best-practices configuration:

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-admin repository) and how to give them access to Git repositories (with the gitolite configuration file in the gitolite-admin repository).

  • 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.


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:

Uploading Personal ssh Keys to Amazon EC2

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.

instance_id=$(aws ec2 run-instances   --region "$region"   --key-name "$USER"   --instance-type t1.micro   --image-id "$ami_id"   --output text   --query 'Instances[*].InstanceId')
echo instance_id=$instance_id

Wait until the instance is running:

while state=$(aws ec2 describe-instances     --region "$region" --instance-ids "$instance_id"     --output text --query 'Reservations[*].Instances[*].State.Name');
  test "$state" = "pending"; do sleep 1; done

Make a note of the IP address:

host=$(aws ec2 describe-instances   --instance-ids $instance_id   --output text --query 'Reservations[*].Instances[*].PublicIpAddress')
echo host=$host

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 $

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 git user’s home directory.

  • On first boot, the gitolite setup command 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 ubuntu user. 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:


TBD: How to upgrade Ubuntu packages.

TBD: How to upgrade gitolite software.


The Alestic Git Server software is released under open source licenses. Read more…


There is a public Google group for discussion, announcements, and support of the Alestic Git Server:

Alestic Git Google group

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.


  • 20140930

    • Defaults to EBS SSD boot for performance
    • Upgraded to Ubuntu 14.04 LTS Trusty
    • Upgrade to Git v1.9.1
    • Upgraded to gitolite v3.6.1-6 (master branch)
    • All Ubuntu packages updated to latest versions.
    • Includes important security patches from Ubuntu.
    • Installed unattended-upgrades to automatically apply future security patches.
  • 20140409

    • Upgraded to gitolite v3.5.3.1-17 (master branch)
    • All Ubuntu packages updated to latest versions.
  • 20140328

    • Upgraded to gitolite v3.5.3.1-14 (master branch)
    • All Ubuntu packages updated to latest versions.
  • 20131227

    • Upgraded to gitolite v3.5.3.1-1 (master branch)
    • All Ubuntu packages updated to latest versions.
  • 20131023

    • Upgraded to gitolite v3.5.3.1 (master branch)
    • All Ubuntu packages updated to latest versions.
  • 20130830

    • Upgraded to gitolite v3.5.2-4 (master branch)
    • All Ubuntu packages updated to latest versions.
  • 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)


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.


Hi Eric,
Thanks for the article. I have a question about multiple availability zones for git server.
Is there any nice way to keep a few git servers, synced together in multiple az. Or better to just backup one frequently and spin up a new one from backup in other az when its needed?


The Alestic Git server is simply Git+gitolite running on EC2. Any questions you have about managing or mirroring repositories should be questions for Git or gitolite.

In this case, gitolite has a document talking about mirroring:

For maximum separation, I would recommend using multiple EC2 regions instead of just multiple availability zones.

Leave a comment

Ubuntu AMIs

Ubuntu AMIs for EC2:

More Entries

Persistence Of The AWS Lambda Environment Between Function Invocations
AWS Lambda functions are run inside of an Amazon Linux environment (presumably a container of some sort). Sequential calls to the same Lambda function could hit the same or different…
Before You Buy Amazon EC2 (New) Reserved Instances
understand the commitment you are making to pay for the entire 1-3 years Amazon just announced a change in the way that Reserved Instances are sold. Instead of selling the…
S3 Bucket Notification to SQS/SNS on Object Creation
A fantastic new and oft-requested AWS feature was released during AWS re:Invent, but has gotten lost in all the hype about AWS Lambda functions being triggered when objects are added…
AWS Lambda: Pay The Same Price For Faster Execution
multiply the speed of compute-intensive Lambda functions without (much) increase in cost Given: AWS Lambda duration charges are proportional to the requested memory. The CPU power, network, and disk are…
Exploring The AWS Lambda Runtime Environment
In the AWS Lambda Shell Hack article, I present a crude hack that lets me run shell commands in the AWS Lambda environment to explore what might be available to…
lambdash: AWS Lambda Shell Hack
I spent the weekend learning just enough JavaScript and nodejs to hack together a Lambda function that runs arbitrary shell commands in the AWS Lambda environment. This hack allows you…
AWS Lambda Walkthrough Command Line Companion
The AWS Lambda Walkthrough 2 uses AWS Lambda to automatically resize images added to one bucket, placing the resulting thumbnails in another bucket. The walkthrough documentation has a mix of…
When Are Your SSL Certificates Expiring on AWS?
If you uploaded SSL certificates to Amazon Web Services for ELB (Elastic Load Balancing) or CloudFront (CDN), then you will want to keep an eye on the expiration dates and…
Throw Away The Password To Your AWS Account
reduce the risk of losing control of your AWS account by not knowing the root account password As Amazon states, one of the best practices for using AWS is Don’t…
AWS Community Heroes Program
Amazon Web Services recently announced an AWS Community Heroes Program where they are starting to recognize publicly some of the many individuals around the world who contribute in so many…
EBS-SSD Boot AMIs For Ubuntu On Amazon EC2
With Amazon’s announcement that SSD is now available for EBS volumes, they have also declared this the recommended EBS volume type. The good folks at Canonical are now building Ubuntu…
EC2 create-image Does Not Fully "Stop" The Instance
The EC2 create-image API/command/console action is a convenient trigger to create an AMI from a running (or stopped) EBS boot instance. It takes a snapshot of the instance’s EBS volume(s)…
Finding the Region for an AWS Resource ID
use concurrent AWS command line requests to search the world for your instance, image, volume, snapshot, … Background Amazon EC2 and many other AWS services are divided up into various…
Changing The Default "ubuntu" Username On New EC2 Instances
configure your own ssh username in user-data The official Ubuntu AMIs create a default user with the username ubuntu which is used for the initial ssh access, i.e.: ssh ubuntu@<HOST>…
Default ssh Usernames For Connecting To EC2 Instances
Each AMI publisher on EC2 decides what user (or users) should have ssh access enabled by default and what ssh credentials should allow you to gain access as that user.…
New c3.* Instance Types on Amazon EC2 - Nice!
Worth switching. Amazon shared that the new c3.* instance types have been in high demand on EC2 since they were released. I finally had a minute to take a look…
Query EC2 Account Limits with AWS API
Here’s a useful tip mentioned in one of the sessions at AWS re:Invent this year. There is a little known API call that lets you query some of the EC2…
Using aws-cli --query Option To Simplify Output
My favorite session at AWS re:Invent was James Saryerwinnie’s clear, concise, and informative tour of the aws-cli (command line interface), which according to GitHub logs he is enhancing like crazy.…
Reset S3 Object Timestamp for Bucket Lifecycle Expiration
use aws-cli to extend expiration and restart the delete or archive countdown on objects in an S3 bucket Background S3 buckets allow you to specify lifecycle rules that tell AWS…
Installing aws-cli, the New AWS Command Line Tool
consistent control over more AWS services with aws-cli, a single, powerful command line tool from Amazon Readers of this tech blog know that I am a fan of the power…
Using An AWS CloudFormation Stack To Allow "-" Instead Of "+" In Gmail Email Addresses
Launch a CloudFormation template to set up a stack of AWS resources to fill a simple need: Supporting Gmail addresses with “-” instead of “+” separating the user name from…
New Options In ec2-expire-snapshots v0.11
The ec2-expire-snapshots program can be used to expire EBS snapshots in Amazon EC2 on a regular schedule that you define. It can be used as a companion to ec2-consistent-snapshot or…
Replacing a CloudFront Distribution to "Invalidate" All Objects
I was chatting with Kevin Boyd (aka Beryllium) on the ##aws Freenode IRC channel about the challenge of invalidating a large number of CloudFront objects (35,000) due to a problem…
Email Alerts for AWS Billing Alarms
using CloudWatch and SNS to send yourself email messages when AWS costs accrue past limits you define The Amazon documentation describes how to use the AWS console to monitor your…
Cost of Transitioning S3 Objects to Glacier
how I was surprised by a large AWS charge and how to calculate the break-even point Glacier Archival of S3 Objects Amazon recently introduced a fantastic new feature where S3…
Running Ubuntu on Amazon EC2 in Sydney, Australia
Amazon has announced a new AWS region in Sydney, Australia with the name ap-southeast-2. The official Ubuntu AMI lookup pages (1, 2) don’t seem to be showing the new location…
Save Money by Giving Away Unused Heavy Utilization Reserved Instances
You may be able to save on future EC2 expenses by selling an unused Reserved Instance for less than its true value or even $0.01, provided it is in the…
Installing AWS Command Line Tools from Amazon Downloads
This article describes how to install the old generation of AWS command line tools. For the most part, these have been replaced with the new AWS cli that is…
Convert Running EC2 Instance to EBS-Optimized Instance with Provisioned IOPS EBS Volumes
Amazon just announced two related features for getting super-fast, consistent performance with EBS volumes: (1) Provisioned IOPS EBS volumes, and (2) EBS-Optimized Instances. Starting new instances and EBS volumes with…
Which EC2 Availability Zone is Affected by an Outage?
Did you know that Amazon includes status messages about the health of availability zones in the output of the ec2-describe-availability-zones command, the associated API call, and the AWS console? Right…