You don't own your code if it lives on someone else's metal.
It is 2012, and the trend of offloading everything to "the cloud" is reaching a fever pitch. GitHub is great for open source, but for a private development shop in Oslo or Bergen, relying on US-based servers is a tactical error. You are dealing with 120ms+ latency on every git push, monthly fees that scale with your privacy needs, and the looming legal gray area of the US Patriot Act regarding your intellectual property.
If you are serious about latency and data sovereignty, you build your own. In this guide, we are going deep into deploying a secure, multi-user Git server using Gitolite on CentOS 6.2. No GUI bloat, just raw performance.
Why Self-Hosted Git in Norway?
Beyond the obvious cost savings on private repositories, the technical argument is purely about physics. Git is a distributed version control system, but heavy operations like cloning massive repositories or CI/CD integration rely heavily on network throughput and disk I/O.
Pro Tip: When your VPS is located at the NIX (Norwegian Internet Exchange), your latency drops from ~120ms (US East Coast) to under 5ms. For a team of ten developers pushing code fifty times a day, that efficiency compounds rapidly.
Furthermore, complying with the Personopplysningsloven (Personal Data Act) is significantly easier when you know exactly which physical rack your data resides in.
The Architecture: Gitolite + SSH
We aren't just creating a shared Linux user; that is a security nightmare. We are using Gitolite. It sits on top of OpenSSH and allows you to define granular access control lists (ACLs) for repositories without giving your developers shell access to the server.
Prerequisites:
- A fresh CoolVDS instance running CentOS 6.x (Minimal Install).
- Root access.
- A local workstation with your public SSH key ready.
Step 1: System Prep and Dependencies
First, update your system and install the necessary packages. We need Git (obviously) and Perl for Gitolite.
[root@coolvds ~]# yum update -y
[root@coolvds ~]# yum install git perl openssh-clients -yCreate a dedicated user for Git. This is the only user your team will technically connect to, separated by SSH keys.
[root@coolvds ~]# adduser git
[root@coolvds ~]# passwd -l gitStep 2: Installing Gitolite
Gitolite isn't in the standard repositories yet, so we clone it from the source. Switch to the git user to keep permissions clean.
[root@coolvds ~]# su - git
[git@coolvds ~]$ git clone git://github.com/sitaramc/gitolite
[git@coolvds ~]$ mkdir -p $HOME/bin
[git@coolvds ~]$ gitolite/install -to $HOME/binStep 3: The Setup Hook
Upload your local workstation's public key (e.g., id_rsa.pub) to the server. Let's assume you SCP'd it to /tmp/admin.pub.
[git@coolvds ~]$ $HOME/bin/gitolite setup -pk /tmp/admin.pubIf you see an initialized empty Gitolite admin repo, you are live.
Performance Tuning: The Disk I/O Bottleneck
Here is where most generic VPS providers fail. Git is incredibly I/O intensive, specifically when packing objects or running garbage collection (git gc). On a standard SATA hard drive, a large team can bring the server to a crawl due to I/O wait times.
This is why we architect CoolVDS on KVM (Kernel-based Virtual Machine) with pure SSD storage arrays. Unlike OpenVZ containers that fight for kernel resources, KVM gives you dedicated interrupt handling. When you are writing thousands of small objects during a large commit, SSD random write speeds (IOPS) are the only metric that matters.
Optimizing TCP for Nordic Peering
Since we are optimizing for low latency within Northern Europe, we can tweak the TCP stack in /etc/sysctl.conf to handle bursty traffic better:
# /etc/sysctl.conf
net.ipv4.tcp_window_scaling = 1
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216Apply these with sysctl -p. This ensures your Git over SSH connections utilize the full bandwidth available on our gigabit uplinks.
Managing Access
You never log into the server to create new repos. You do it via Git. Back on your local machine:
git clone git@your-coolvds-ip:gitolite-adminEdit the conf/gitolite.conf file to add a new project:
repo new-project
RW+ = alice
R = bobCommit and push. Gitolite's hooks instantly configure the server-side permissions. It is elegant, secure, and requires zero maintenance on the server itself.
The Verdict
By hosting on CoolVDS, you have achieved three things:
- Speed: Sub-5ms latency for your Norwegian team.
- Security: Granular access control without shell access.
- Reliability: RAID-protected SSD storage that eats Git I/O for breakfast.
Don't let your infrastructure be the bottleneck in your release cycle. Spin up a CentOS 6 instance today and take back control of your code.