Drobox as a private github

Using Dropbox as your private github

Go back to Code In this article I assume you understand the following Git vocabulary at a daily usage level:

  • remote
  • origin
  • branch
  • fetch
  • push

One way to keep an online remote, for backup or collaboration purposes is to use your Dropbox folder.

This allows you to have a private online repository, which you can share with selected users.

I'm going to run through the steps to set this up.

I assume you have an existing repository locally, which you want to mirror online.

First make sure everything relevant is committed:

user@host:~/code/myrepo$ git status/
 # On branch master
 nothing to commit (working directory clean)

I'm going to first make a directory in my dropbox for all my repositories:

user@host:~/code/myrepo$ mkdir ~/Dropbox/repositories

Then I will create the upstream repository:

Here we use a bare checkout, so that we don't waste space or effort on storing the working copy files, but instead store only the .git information (which includes all the data to create the working copy).

user@host:~/code/myrepo$ cd ~/Dropbox/repositories
user@host:~/Dropbox/repositories$ git clone --bare ~/code/myrepo/.git myrepo.git
Initialized empty Git repository in /home/user/Dropbox/repositories/myrepo.git/

Now we add the new Dropbox repository as our origin

cd to your original repository again.

user@host:~/code/myrepo$ git remote add origin ~/Dropbox/repositories/myrepo.git
user@host:~/code/myrepo$ git fetch origin
From /home/user/Dropbox/repositories/myrepo
 * [new branch]      master     -> origin/master

Finally, set up fetch and push links

These links tell git that your local master tracks origin/master and tells git where to fetch from and push to.

user@host:~/code/myrepo$ git branch --set-upstream master remotes/origin/master

The above command basically peforms the following:

user@host:~/code/myrepo$ git config branch.master.remote origin
user@host:~/code/myrepo$ git config branch.master.merge refs/heads/master

Finally

Now you should be able to do git pull and git push as you like... You can share the repository with other users by using the Dropbox sharing features, but I wouldn't yet recommend this, as I haven't explored the problems this may create.

Post your comment

Posting comments has been disabled.

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments