Backup your git repositories on Dropbox
After installing Dropbox, create a new folder for your repository backup:
cd ~/Dropbox
mkdir myrepo.git
cd myrepo.git
git init --bare
Then go to your existing repo and add a new remote for Dropbox:
cd ~/code/myrepo
git remote add dropbox ~/Dropbox/myrepo.git
Now you can backup your code by pushing to Dropbox:
git push dropbox master
You can then clone the repository from Dropbox:
git clone ~/Dropbox/myrepo.git
Written by Christian Joudrey
Related protips
6 Responses
considering the efficiency of the git protocol and the cost of private repositories at bitbucket, I'm wondering what use case triggered that ?
Nice idea, but isn't it easier to simply have your ~/code/myrepo inside Dropbox directly? That way you don't have to manually push every time, and you can always turn of Dropbox sync during development to avoid wasting bandwith, and sync only at the end of the day
Dropbox may cause corruption or disappearance of files. I personally experienced that before. Using Dropbox heavily like Git will probably cause a lot of problem.
It was quite painfull experience, only git bundle really worked for me with dropbox backups:
http://stackoverflow.com/questions/2129214/backup-a-local-git-repository/2129286#2129286
@mcansky I was forced to use similar (git bundle) technique before bitbucket got git support, but you're right, this days such tip feels a bit outdated, bitbucket really rocks with it's free, unlimited private repositories :)
This is pointless. Bitbucket is like free.