The easiest way to use a Dropbox for git repositories
Shell Makefile
Switch branches/tags
Nothing to show
Latest commit 11e9bc0 Feb 18, 2015 @agnoster agnoster Merge pull request #6 from MetaMemoryT/remote-add
Remote add


STATUS: Stable (as of 2012-08-03) — This isn't a terribly complicated project, and it seems relatively bug-free. No further improvements are currently planned, but issues filed will be responded to.

A recent stackoverflow answer got me thinking: what's the easiest way to use Dropbox for your git repos?

How about just typing this:

git dropbox

And your repo gets mirrored to a bare repo in your Dropbox! Sound like a good time? Read on!


To install (this may require sudo):

curl -o /usr/local/bin/git-dropbox
chmod +x /usr/local/bin/git-dropbox

Now, in any git project, run the following:

git dropbox
  • If you haven't run it before, it will prompt you for a location to create git repos.
    • Default: $HOME/Dropbox/git
    • Saves this to git config --global dropbox.folder
  • Creates that folder if it doesn't exist
  • Creates a new bare repo matching the name of your git project's directory
    • So, for my_project, the default location would be $HOME/Dropbox/git/my_project.git
  • Does a git push $NEW_BARE_REPO --mirror

Simple. Now, whenever you do a git dropbox it will re-mirror to the same directory.


Q: Why doesn't it just add a remote and let you push?
A: I wanted it as simple as possible. git dropbox and you're done. If you add it as a remote it ends up pushing tracking branches for itself when you mirror, which just seems weird.

Q: What if I want to push a single project to a different place? (Like maybe a toplevel directory for sharing?)
A: First off: if you are sharing, I highly recommend you don't have multiple people push to one repo. Better to each have a dropbox repo and pull from each other when need be. But you can in fact set the location of the mirror bare repo with a simple config variable:

git config dropbox.repo /path/to/dropbox/repo