Last Updated: September 09, 2019
·
4.858K
· cjoudrey

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

6 Responses
Add your response

considering the efficiency of the git protocol and the cost of private repositories at bitbucket, I'm wondering what use case triggered that ?

over 1 year ago ·

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

over 1 year ago ·

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.

over 1 year ago ·

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

over 1 year ago ·

@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 :)

over 1 year ago ·

This is pointless. Bitbucket is like free.

over 1 year ago ·