Home | Published: Feb 17, 2025

Hosting a private git server

This guide is unfinished. The content is present but the detail is sparse.

Prerequisites

You are expected to have the following set up already

Introduction

Git was designed to work simply in a server environment. Given that you are already logging in with an unprivelaged user over ssh, this user can also manage your git repositories. The git handbook concisely describes how to set up git on the server.

Organization

I prefer to store most of my git repositories in ~/git, for consistency. The only exception to this rules is how I handle websites. The git repo will typically sit in /var/www/example.com. This means that we can't push directly to main on our site repos. This isn't a bad thing. I push to a separate dev branch and merge.

The only downside to this setup is that I need to take 2 minutes to ssh into my server and create create a bare git repo before I can push my initial commit. A short script could definitely automate this.