Get off my lawn.

Saturday, July 30, 2011

Quick and dirty distributed Git repository

A friend told me about a cool trick for using DropBox as a distributed Git repository, and I adapted the approach for use with Ubuntu One.

In your ~/Ubuntu One directory, do this:

mkdir -p repo/myproject
cd repo/myproject
git init --bare

Then in your project directory, do this:

git remote add uone $HOME/Ubuntu\ One/repo/myproject

Now, when you want to push changes to your Ubuntu One directory, just do this:

git push uone master

...and it will be shared according to Ubuntu One's upload settings.

You can share your repo directory with others, and they can get your changes by doing this in a project directory (once their sync directory is populated with the shared folder's contents):

git clone $HOME/Ubuntu\ One/repo/myproject

...and that appears to be it.

Obviously, it's not what you'd typically do for a big project, but for small things you want to share with specific people, it works pretty well (not to mention providing a handy backup).


Post a Comment

Subscribe to Post Comments [Atom]

<< Home