Git and Dropbox Comment

1:39 am on February 9, 2011

I started a couple of projects recently, both iPhone apps with Ruby on Rails backends – one I am working on by myself and the other with a friend. In both cases I am using Git as the source control and needed a central repo. After looking at Github, which is a great service, I decided I did not want to pay to host a private project considering the infant stage both these projects were in. So I decided to try and use Dropbox as the remote repository instead. This has worked out surprisingly well for both projects (so much so and to my surprise I decided to write something about it). To set up a project this way you will need to do something like this:

In the project directory …
cd ~/project
git init
git add .
git commit -m "initial commit"

In the Dropbox folder …
cd ~/Dropbox/git
mkdir project.git
cd project.git
git init --bare

Push project to remote …
cd ~/project
git remote add dropbox ~/Dropbox/git/project.git
git push dropbox master

To update your local copy …
git pull dropbox master

Dropbox obviously takes care of the syncing between machines and/or different users and unless you are on a really slow network connection or committing very large amounts of data the syncing takes no time at all.

My main worry about using Dropbox as a git remote repo was that pushing or pulling code while someone else is committing would cause corruption to the repo or my own local version. So far I have not come across this problem and I even tried to git pull during dropbox syncing.

Leave a Reply

Have something to say? Jump right in!     Formatting

(required)
(required)

Close

Formatting Your Comment

The following XHTML tags are available for use:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

URLs that start with http:// are automatically converted to hyperlinks.