Steven Jewel Blog RSS Feed

13 Sep 2013

Serverless private git repositories

With BitTorrent Sync it is easy to share a git repository in read-only or read-write mode. While it has always been possible to push a copy of your repository to a web server via ssh, configuring access control can be a burden when first starting a project.

Here's the basic steps:

  1. Install btsync.

  2. Create a bare repository. You won't do any work in this directory, but instead it will act as a remote where you will push and pull.

    git init --bare ~/projects/secret.git
  3. Checkout a copy of your repository:

    git clone ~/projects/secret.git ~/projects/secret

    This will create a new directory called secret.

  4. Create your first commit in the secret directory.

    echo world domination plans > README
    git add README
    git commit -m 'first commit'
  5. Push it to the secret.git directory.

    git push
  6. Add the secret.git directory to btsync. btsync will give you an read-only key that you can share with minions, or a read-write key that you can share with covillains.

  7. The other person adds the key into the btsync app and has it sync to the ~/projects/secret.git directory.

  8. The other person checks out a local copy.

    git clone ~/projects/secret.git ~/projects/secret
  9. The other person can now work as normal. If she has the read-write key, she can push directly back into the repository.

  10. btsync will keep the secret.git changes in sync. It normally syncs instantly.