Console Login

Centralized Git Server Deployment on Ubuntu 10.04: Secure Team Collaboration in Norway

Centralized Git Server Deployment: Secure Team Collaboration in Norway

If you are still wrestling with Subversion (SVN) merge conflicts or waiting for CVS to commit a simple patch, stop. It is 2010. Distributed Version Control Systems (DVCS) are not just a trend; they are the standard for any serious development team. But here is the problem: hosting your code on public services in the US creates latency issues and raises questions about data sovereignty—especially here in Norway under Datatilsynet's watchful eye.

I have seen development teams in Oslo lose hours of productivity simply because their repository host was negotiating connections across the Atlantic. When you type git push, you want it done instantly. You don't want to wait for the handshake.

This guide cuts through the noise. We are going to set up a private, secure Git server on a CoolVDS instance running Ubuntu 10.04 LTS (Lucid Lynx). We will rely on SSH for transport because it is battle-tested, encrypted, and requires zero complex web server configuration.

The Architecture of Trust

In a recent project migration for a media house in Bergen, we faced a critical issue: their SVN repository was 40GB, hosted on a slow mechanical drive in a basement. Checkouts took 45 minutes. By migrating to a Git workflow on a VPS with fast disk I/O, we cut deployment times to seconds.

However, raw speed isn't enough. You need security. We will configure a restricted shell environment so developers can push code but cannot browse your server's filesystem.

Pro Tip: Latency kills flow. Pushing code from Oslo to a server in Oslo (NIX) typically takes <10ms. Pushing to the US West Coast can take 150ms+. For frequent commits, that lag adds up to hours of lost focus per year. Hosting locally on CoolVDS isn't just about patriotism; it's about physics.

Step 1: Environment Preparation

We assume you have a fresh CoolVDS VPS instance. Why? Because Git operations, especially garbage collection (git gc) and compression, are CPU and I/O intensive. Our Enterprise SSD storage tiers (a rarity in 2010) ensure that your repo never becomes the bottleneck.

First, update your package lists and install the core Git binaries. Note that on Ubuntu 10.04, the package is named git-core.

root@coolvds-node1:~# apt-get update
root@coolvds-node1:~# apt-get install git-core python-setuptools openssh-server

Step 2: Creating the Git User and Restricting Shell Access

Security is paramount. We do not want developers logging in and running rm -rf /. We will create a dedicated `git` user and assign it the `git-shell`, a login shell included with Git that restricts activity to Git-only commands.

Check where `git-shell` is located:

root@coolvds-node1:~# which git-shell
/usr/bin/git-shell

Now, add the user and set the shell:

root@coolvds-node1:~# useradd -m -d /home/git -s /usr/bin/git-shell git
root@coolvds-node1:~# mkdir -p /home/git/.ssh
root@coolvds-node1:~# chmod 700 /home/git/.ssh
root@coolvds-node1:~# touch /home/git/.ssh/authorized_keys
root@coolvds-node1:~# chmod 600 /home/git/.ssh/authorized_keys
root@coolvds-node1:~# chown -R git:git /home/git

Step 3: Managing Access with SSH Keys

Password authentication is a security risk and an annoyance for automation. We will rely strictly on RSA keys. On your local developer machine (the client), generate a key pair if you haven't already:

local-dev$ ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa_coolvds

Paste the content of your public key (id_rsa_coolvds.pub) into the server's /home/git/.ssh/authorized_keys file. In a production environment, you might automate this with a configuration management tool like Puppet or CFEngine, but for a small team, manual entry is acceptable.

Step 4: Initializing the Bare Repository

A "bare" repository contains no working directory—it is purely the database of your code history. This is required for a central server to accept pushes without corruption.

Log in to the server (or `su` to git user technically, though `git-shell` prevents interactive login, so we do this as root and fix permissions):

root@coolvds-node1:~# cd /home/git
root@coolvds-node1:/home/git# mkdir projectx.git
root@coolvds-node1:/home/git# cd projectx.git
root@coolvds-node1:/home/git/projectx.git# git --bare init
Initialized empty Git repository in /home/git/projectx.git/
root@coolvds-node1:/home/git/projectx.git# cd ..
root@coolvds-node1:/home/git# chown -R git:git projectx.git

Step 5: The Local Workflow

Now, back on your local workstation. It is time to connect your local project to your new secure fortress in Oslo.

local-dev$ cd my-project
local-dev$ git init
local-dev$ git add .
local-dev$ git commit -m "Initial commit"
local-dev$ git remote add origin git@your-coolvds-ip:projectx.git
local-dev$ git push origin master

If you set up the SSH keys correctly, the code flies to the server. No passwords, no insecure FTP, just raw, encrypted data transfer.

Performance Tuning: The CoolVDS Edge

While Git is efficient, large repositories with binary assets can strain standard virtual machines. This is where the underlying hardware of your VPS provider matters.

Many providers oversell their CPUs. When your team runs git clone simultaneously on a Monday morning, the server load spikes. If the host node is choked, your connection drops.

Feature Standard VPS CoolVDS Architecture
Storage SATA HDD (Slow Seeks) Enterprise SSD / SAS 15k RPM RAID-10
Virtualization OpenVZ (Oversold) KVM (Kernel-based Virtual Machine)
Network Congested Global Routes Premium Peering (NIX - Oslo)

At CoolVDS, we utilize KVM virtualization. This ensures that the RAM and CPU resources allocated to your Git server are yours alone. No "noisy neighbors" stealing cycles during your critical merge windows.

Hardening SSH for Production

Before you go live, tweak the SSH daemon configuration to prevent unauthorized access attempts. Edit /etc/ssh/sshd_config:

# /etc/ssh/sshd_config
Port 22
Protocol 2
PermitRootLogin no
PasswordAuthentication no
UseDNS no
AllowUsers git sysadmin

Restart the service to apply changes:

root@coolvds-node1:~# service ssh restart

This configuration enforces key-only authentication and disables DNS lookups for faster login times—crucial when you are pushing code dozens of times a day.

Data Sovereignty and Compliance

Even though we are engineers, we must respect the legal landscape. Hosting data within Norway simplifies compliance with the Personopplysningsloven (Personal Data Act). If your code contains sensitive customer data or hardcoded credentials (which it shouldn't, but happens), keeping it on servers physically located in Oslo or Stavanger offers legal safeguards that hosting in the US cloud does not.

Conclusion

You now have a Git server that is faster, more secure, and more reliable than a generic hosted solution. You own the data. You control the uptime. You have eliminated the Trans-Atlantic latency.

Don't let slow I/O kill your team's momentum. Deploy a high-performance, KVM-based instance today.

Deploy your CoolVDS Instance in 55 seconds and start pushing code at the speed of thought.