Using Dropbox or Google Drive as a backup for your Git repository

I’m currently working on a small hobby project in my spare time. I’m using Git as my DVCS. Most of the development is done on my laptop. And I would like to have a backup of my repository in a secure, remote location.

Sure, I could use Github to host my repository (and I plan to publish it there in the future), but for now my code is not yet stable enough to show it to the rest of the world. I’m a strong believer that you should have something useful before showing it to the rest of the world. I dislike open source projects that do not work out of the proverbial box.

Dropbox or Google Drive can help with that. When you install the client an extra folder is created on your system. All files you copy to this folder will be synced to Dropbox/Google.

This in combination with Git makes for a perfect, cheap back-up solution. I started by cloning my Git repository in the Dropbox folder.

Here I created a bare (without working directory) clone of my Git repository in the Dropbox folder. Dropbox will now automatically start syncing this. Next, I define this new clone as a remote for my local repository. I use the name ‘dropbox’ for the remote.

Now, whenever I’m done working in my local repository I just do:

This pushes all my changes in master to the remote repository in the Dropbox folder. Dropbox will automatically sync it to my account. I can install the Dropbox client on any other computer, retrieve the repository from Dropbox, clone it and start hacking.

Beware however that this is not a completely foolproof back-up solution. You could get in trouble whenever you push to Dropbox and switch off your computer before Dropbox had a chance to sync everything. If you then try to retrieve the Dropbox repository on a new computer you will probably have a corrupted Git repository.

However it works for me as a cheap extra back-up.


  1. Thanks for sharing this! Regardless of what's the process and risks involved, having a backup for one's files is important. A lot of people are on the back end of an irresponsible file management and end up losing all their important data. I hope this post helps a lot of people.

    Ruby Badcoe @ Williams Data Management

  2. where is the instruction for google drive

  3. Google drive ofcourse works exactly as Dropbox. Simply use the folder provided for you by Google drive to place your repository.


Post a Comment

Popular posts from this blog

Small tip: use QueueBackgroundWorkItem for asynchronous work in ASP.NET

Why you should use git merge --no-ff when rebasing.

Using NUnit for your tests in Team Foundation Service with a Git repository