My Private Git Setup

up

2014-10-26

Occasionally I work on a project that I want in version control, duplicated in a central location, but don’t want to throw it into the public eye. I don’t need much to accomplish this – a Raspberry Pi sitting headless on my home network works perfectly.

Basically, I use git+ssh to do operations on my repos remotely, and klaus + gunicorn to browse and dig through my repos when I want to.

It’s a pretty smooth setup!

The most complicated parts of this setup are:

  1. I use a virtualenv to wrap gunicorn, klaus, and dependencies in their own python environment
  2. I use this gunicorn command (which uses klaus.contrib.wsgi_autoreload pointed at a single directory containing only git repo subdirectories):
    exec /path/to/gunicorn -w 1 -b 0.0.0.0:80 \
        --env KLAUS_SITE_NAME="You Have The GITS" \
        --env KLAUS_REPOS="/path/to/git/repo/parent/dir" \
        --log-level error --log-file /var/log/klaus.log \
        klaus.contrib.wsgi_autoreload

Combined with some basic ssh configuration (setting up a Host ‘shortcut’ in my ~/.ssh/config file and authorizing my public key for a user on my raspberry pi), this method is very low-friction to work with and I get a nice UI to browse my source with, if I want!