the fast, reliable localhost tunneling solution

Easily Share Git Repositories

By Bjarni RĂșnar 2012-03-04, 23:48

Git is a fantastic distributed revision control system for source code and other text-based projects. At PageKite, we use it for everything...

Although most projects use centralized source repositories like GitHub to publish and share git trees, that is not actually necessary, because git knows how to speak HTTP directly. Any live git repository can be cloned or pulled if it is made visible to the web - including the working tree on your workstation or laptop.

PageKite of course makes it very easy to put anything on the web...

An example

What follows is a complete "hello world" example. Feel free to go through the steps and try them yourself! This should work on any machine with an active Internet connection. No static IP required.

First, we create the repository:

$ mkdir project
$ cd project
$ git init
Initialized empty Git repository in ...

Then we add a file:

$ echo hello world > hello.txt
$ git add hello.txt
$ git commit -m 'Initial import'
[master (root-commit) 9a2639a] Initial import
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 hello.txt

This command is the one that prepares the .git folder for remote access over the web. You need to re-run this command any time you want to make the changes you have committed visible to others:

$ git update-server-info

That's all for git. Obviously you only really need that last command if you already have some code you would like to share...

Make the repo visible

Next we will add the repository to our configuration, so it becomes visible to the web whenever we run the program. Note that this example assumes you have already downloaded and created a account named - please edit the examples to match your actual account details.

First we create and register a kite (domain) for the project. Let's use's built-in HTTP server and protect the repo with a user-name and password:

$ --add . +password/gituser=awesome

Note the ".", which represents the current working directory. If you are in some other directory, simply replace the dot with the full path to the repo you want to share.

Next, we start and leave it running. For this demo we only want to expose this particular project, so we specify the name of the site on the command line:


Finally, in another terminal (or on another machine), we test it:

$ git clone
Cloning into
$ cat hello.txt
hello world


A clone of the repository should have been created, named

You can git pull at any time to bring it back into sync with the original.

From the point of view of the person publishing the code, with this set up the command git update-server-info takes the place of git push - you run that command whenever you want to make recent changes visible to the world.

Things to keep in mind

Note that the built-in HTTP server is not particularly fast or efficient, so if you plan to do this on a regular basis, it may be better to make your project trees visible to Apache, Nginx or some other web server and configure your system for always-on operation.

But for quick demos or one-off private pull requests, the built-in server may be just the thing...

Please also keep in mind that your working tree will be fully accessible from the web - so be sure to take whatever steps you feel necessary for security. You might also want to add an index.html file to the project, as a friendly welcome for folks who visit using a normal web browser.

Happy hacking!


  1. Bjarni RĂșnar Einarsson said on 2012-03-05, 11:30
    If you liked this, please up-vote it on Hacker News:

    Thanks! :-)
  2. Michael said on 2013-07-31, 14:05
    Great use case!
    Please tell me how can I restrict "git clone..." to https access only.
  3. mjoshim said on 2015-01-11, 20:32
    No working

Leave a comment

( (Please leave these blank: )

We use Gravatar for commenter's photos. Get your own, it's free!