Dropbox for Git Repositories

We’ve all had that horrid experience where you’ve changed some files, saved, closed, and realized that you’ve made a mistake. This is where version control comes in and in this post I will show how you can use two free resources to make your own cloud-backed sharable code repository.

What is version control? Git

Version control helps us to maintain versions of files or whole projects. Git is just one of many such version control systems and I use it exclusively on all my projects.

Why Git?

Git is a small open source system which is available on all platforms. It is easy to learn, fast, and packed with features. Some of the big names in the development industry use Git. But how does one store your git repositories safely and securely with backups and share it with team mates?

Git Hosting

The first place one should look for hosting Git repositories is Github. Github provides all you’ll ever need for hosting repositories and collaborating with team mates. It is, however, only free if you host open source projects.

Alternatives

Some alternatives to Github exist, such as Google Code and SourceForge. But they also just offer free hosting for open source projects. Now if you have the budget to pay their rates (which is very reasonable) please do so! And if you can open source your project, even better!

Bitbucket is also a feature-filled hosted repository for Git, boasting with free unlimited private (proprietary) repositories for up to five team members, or more if you are willing to pay.

If you are, however, looking for an alternative for a small team, working on proprietary projects, I’ve found an easy alternative.

Dropbox for Git Repositories Dropbox

I will show you how you can use Dropbox for storing your git repositories and sharing your projects with your co-workers.

What is Dropbox?

Dropbox is a file hosting service offering secure cloud-storage, synchronization and portable free client applications. Dropbox gives every user 2 GiB  of storage for free, at the time of this writing, which is plenty for storing your projects. Dropbox also provides a payed service for larger capacity and even for businesses.

Integrating with Git

First of all, in the examples I show how to set up the repositories by using Ubuntu 13.10, however the process can be repeated in a similar way for other operating systems.

Installing Git

 Installing Dropbox

Get the relevant installer from here and install, no surprises there. The installer will guide you through the setup process and  allow you to create a new account also. If you already have one, just provide the login details.

Creating a Git repository

Assuming the default settings for Dropbox, here is a snippet showing how to create a new bare repository named foo.

This repository will automatically sync to the cloud. This repository will be the pristine repository and should not be used directly.

Cloning…

No, Dolly is not the subject of the discussion. You have to clone your repository to your local working folder.

You now have a cloned empty repository. Now you can add a file or a project and push to the repository.

Magically your new commit will be pushed to the cloud-backed Dropbox folder.

Sharing

In order to share the repository, you can use Dropbox’s folder sharing feature. This will allow bi-directional access to the Git repository. This screenshot shows how to invite people to your repository folder (use foo.git in the example above)

Sharing a folder step 1
Sharing a folder step 1
Sharing a folder step 2
Sharing a folder step 2

Just type the email address(es) of the team, add a relevant message, and there you have it. Remember to follow the same cloning procedure above for each team member.

Disclaimer

I must confess, I did not test scenarios where more than one person writes to the repository simultaneously, but for a small team it is not difficult to co-ordinate.

Summary

You can use Dropbox along with Git to securely and safely (and freely) store your projects while allowing your team to collaborate with you from anywhere in the world. The examples in this post are for demonstration purposes only.

You can use any method for cloning the repositories. Most IDE’s I use already have a built-in Git function to clone a project from a repository (from the Dropbox path).

I strongly suggest the further reading section below if you are not comfortable with using Git or Dropbox.

Please comment below if you have any questions, suggestions or comments.

Further reading

Edit 12 Apr 2014: Thanks to Stephen Cox for suggesting Bitbucket!

2 Replies to “Dropbox for Git Repositories”

Leave a Comment