Oliver Schrenk bio photo

Oliver Schrenk

I'm a software consultant living in Amsterdam. I enjoy working with Git, Scala, and all things immutable and functional. In my free time I delve in all things sci-fi, play boardgames and learn about coffee.

Email Twitter Github Stackoverflow

Next to my day job as a Scala developer, I am, on occasion, giving Git workshops (shameless plug). While explaining all things Git, I also need to refer to a few Git repositories for demonstration purposes. Normally I hosted these on Github and told the attendees to pull from there.

I saw a few problems with that setup

  1. Implicitly endorsing one vendor over another
  2. People need to be registered at that vendor

While I believe that Github is doing great work, I don’t really want to promote their services over other services such as Gitlab or Bitbucket or any other solution for that matter. I also didn’t want to make people signup for on or the other service, if they made other choices for themselves already.

In addition to that, I often want to show or share some impromptu repository, which I don’t want to host on any of these services.

It’s a distributed system, right? I should be able to host them anywhere right?! So, let’s host them on my machine!

I still wanted a nice short and speaking url, though. Tunneling to the rescue.

Setup tunnel

Install ngrok

brew cask install ngrok

Sign up with ngrok

Get your authorization token here and add it

ngrok authtoken <token>


The configuration file is at $HOME/.ngrok2/ngrok.yml. You will already find a token entry.

Let’s define a tunnel:

authtoken: <token>
    proto: http
    addr: 8174
    region: eu
    hostname: git.oschrenk.com

To use a custom domain, you need to pay for ngrok.

Have a registered domain, where you manipulate the CNAME entries of subdomains.

Reserve a domain in ngrok here (choose an appropiate region, I did Europe). Follow the instructions to create custom domains inside ngrok here.

Run git daemon

git clone https://github.com/gittogreat/git-http-server2
cd git-http-server2
npm install -g

Serve repositories

Create a directory to serve repositories from

cd $HOME
mkdir Repos
cd Repos

Create a demo repository

git init --bare demo

Find out the public IP of your attendees (this assumes you are all behind the same IP)

curl ifconfig.co/ip

Serve repositories

git-http-server2 --ip --allowcreation /Users/oliver/Repos &
listening on in /Users/oliver/Repos

Start tunnel

ngrok start git


Now you can not only serve all kinds of repositories but you can also allow your attendees to share their creations with you!

The command line flag --allowcreation allows for pushing repositories to your machine even if they don’t exist yet! They will automatically be created!

To have Jane push her repository to your machine just tell her:

git remote add origin git@git.oschrenk.com:jane/hello.git
git push

Tada! You have the repository and can show the group some things