Stop Outsourcing Your Code Security
If you are still wrestling with Subversion (SVN) merge conflicts in 2011, you are wasting billable hours. The distributed nature of Git isn't just a trend; it's a workflow necessity for agile teams. But here is the friction point: popular services like GitHub are fantastic for open source, but do you really want your proprietary client code sitting on servers in the United States, subject to the Patriot Act?
For Norwegian development teams, the latency to US West Coast servers is a productivity killer. A git push shouldn't give you enough time to brew coffee. We need low latency, strict data control, and raw disk I/O.
In this guide, we are going to build a rock-solid, private Git server using Gitolite on Ubuntu 10.04 LTS. No web GUIs, no bloat—just pure, secure SSH transport.
The Hardware Reality: Why Shared Hosting Fails Git
Git is fast because it’s a content-addressable filesystem. However, operations like git gc (garbage collection) or repacking large repositories are I/O intensive. If you try to run a busy Git server on cheap, oversold shared hosting, your steal time (CPU wait) will skyrocket.
Pro Tip: Always check your disk I/O priorities. On a CoolVDS instance, we utilize enterprise-grade RAID-10 SAS arrays. This ensures that when your team pushes a 500MB update simultaneously, the disk queue doesn't choke. Stability is not an accident; it is architecture.
Step 1: The Base Configuration
We assume you have provisioned a fresh VPS running Ubuntu 10.04 (Lucid Lynx) or Debian 6 (Squeeze). Security is paramount, so we start by locking down SSH.
# On your local machine, generate a key pair for the admin
ssh-keygen -t rsa -f ~/.ssh/git_admin
# Copy the public key to your CoolVDS server
scp ~/.ssh/git_admin.pub root@your-vps-ip:/tmp/git_admin.pub
Step 2: Installing Git and Gitolite
Don't rely on the default apt repositories if they are too outdated, but for 10.04, the package git-core is sufficient. We will create a dedicated system user for Git. This isolates the repositories from the root account—a critical step for security compliance under the Data Protection Directive.
sudo apt-get update
sudo apt-get install git-core
# Create the git user
sudo adduser --system --shell /bin/bash --group --disabled-password --home /home/git git
# Switch to the git user and set up Gitolite
sudo su - git
git clone git://github.com/sitaramc/gitolite
gitolite/src/gl-system-install
gl-setup /tmp/git_admin.pub
The gl-setup command uses the public key we uploaded earlier to initialize the admin repository. Now, you can manage your server remotely without ever logging in as the 'git' user again.
Step 3: Managing Access via Git
Here is where the magic happens. You don't manage users by editing /etc/passwd. You manage them by committing changes to a config file. Clone the admin repo to your local workstation:
git clone git@your-vps-ip:gitolite-admin
cd gitolite-admin
Edit the conf/gitolite.conf file to add a new project and assign developers:
repo internal-project
RW+ = alice
R = bob
Commit and push. Gitolite instantly updates the server's ~/.ssh/authorized_keys file. This is automation at its finest.
The Latency Factor: Norway vs. The World
Why host this in Oslo? Physics. The round-trip time (RTT) from Oslo to a server in Virginia (US) is often 100ms+. To a local CoolVDS instance peering at NIX (Norwegian Internet Exchange), it is under 10ms. When your developers are doing dozens of fetches and pulls a day, that snappy response time keeps them in the "flow" state.
Data Sovereignty and Backups
Under current Norwegian privacy norms (and the Datatilsynet guidelines), keeping sensitive data within national borders is a significant legal safety net. By using a VPS located in Norway, you mitigate the risks associated with safe harbor uncertainties.
However, RAID-10 is not a backup. Ensure you have a cron job running rsync to offload your Git repositories nightly:
# Simple backup script
rsync -avz /home/git/repositories/ backup-user@offsite-storage:/backups/git/
Conclusion
You don't need a bloated GUI to manage code. You need speed, security, and control. By deploying Gitolite on a high-performance Linux VPS, you get a system that scales with your team, not against it.
If you are ready to migrate your repositories, spin up a CoolVDS instance today. We guarantee the dedicated RAM and disk throughput your development workflow demands.