The easiest way to use a Dropbox for git repositories
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:
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 https://raw.github.com/agnoster/git-dropbox/master/git-dropbox.sh chmod +x /usr/local/bin/git-dropbox
Now, in any git project, run the following:
git config --global dropbox.folder
my_project, the default location would be
git push $NEW_BARE_REPO --mirror
Simple. Now, whenever you do a
git dropboxit 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 dropboxand 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