/home/avaidya

Aug 25, 2013

Using Dropbox and Git, Peacefully

It’s been a while!

Recently, I’ve been working on something in Dropbox, and I’ve found the version control… lacking. Well, it’s nothing like having the full power of Git, my favorite version control system. That’s for sure.

Note that the images here will be for Ubuntu 13.04, but the same, general procedure should work for any version of Ubuntu, other Linuxes, Windows, and Mac, provided that the Dropbox client on the platform supports Selective Sync, which is what this whole method will revolve around. The process isn’t too hard, but, in my opinion, the reward definitely makes it worth it.

Create the directory

First, we need to create a fake directory for Git. Navigate to the Dropbox directory (I’ll assume the folder is called asdf):

cd ~/Dropbox/asdf/

If you already have the Git repository initialized, move it out to a temporary directory for the time being.

mv .git/ ../

Now, create the Git directory:

git init .

Disable sync

The next step is to disable synchronization of the ~/Dropbox/asdf/.git directory. Select “Preferences” in the Dropbox indicator.

Then, go to the “Advanced” tab, and click “Selective Sync…”

Switch to “Advanced View” (the button is at the bottom). Now, click the arrow to the left of asdf and click the checkbox next to .git. Note that this will delete the contents of the .git folder, so make sure nothing is in there besides the vanilla directory.

Re-create the .git folder

Now that we’ve disabled sync for that folder, .git should be deleted. So, re-create the repository:

git init .

If you moved your original .git directory out earlier, then, instead of making a new repository, move the old one back in.

mv ../.git/ .

Celebrate!

Serenity at last!

What you also might want to try to do is going through the Dropbox webclient and deleting the contents of .git, but NOT the folder itself.

Now, git away from here. (I’m sorry.) Hope you enjoyed, and do come back! :)

References