Skip to content

Instantly share code, notes, and snippets.

@v0lkan
Created March 20, 2012 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save v0lkan/2134351 to your computer and use it in GitHub Desktop.
Save v0lkan/2134351 to your computer and use it in GitHub Desktop.
How to use Dropbox as a pseudo-private git Repository

I use one big repository for my personal files, documents etc, that I keep under version control.

Every editable item (like CVs to TODO lists etc) is be maintained there.

Here's how I set it up:

Create a Remote Dropbox Repository

volkan@ronin ~/{ProjectPath} $ mkdir dropbox
volkan@ronin ~/{ProjectPath} $ cd dropbox/
volkan@ronin ~/{ProjectPath}/dropbox $ git init

    Initialized empty Git repository in /home/volkan/{ProjectPath}/dropbox/.git/

volkan@ronin ~/{ProjectPath}/dropbox $ git clone --bare . /{DropboxPath}/GIT/dropbox.git

    Cloning into bare repository /{DropboxPath}/GIT/dropbox.git...
    done..
    warning: You appear to have cloned an empty repository.

volkan@ronin ~/{ProjectPath}/dropbox $ git remote add dropbox /{DropboxPath}/GIT/dropbox.git
volkan@ronin ~/{ProjectPath}/dropbox $ touch README.md
volkan@ronin ~/{ProjectPath}/dropbox $ git add .
volkan@ronin ~/{ProjectPath}/dropbox $ git commit -m 'initial commit'

    [master (root-commit) f450874] initial commit
    0 files changed, 0 insertions(+), 0 deletions(-)
    create mode 100644 README.md

volkan@ronin ~/{ProjectPath}/dropbox $ git push dropbox master

    Counting objects: 3, done.
    Writing objects: 100% (3/3), 227 bytes, done.
    Total 3 (delta 0), reused 0 (delta 0)
    Unpacking objects: 100% (3/3), done.
    To /{DropboxPath}/GIT/dropbox.git
    * [new branch]      master -> master

Clone the Remote Dropbox Repository in Another Machine

volkan@ronin ~/{ProjectPath} $ mkdir test
volkan@ronin ~/{ProjectPath} $ cd test
volkan@ronin ~/{ProjectPath}/test $ git clone /{DropboxPath}/GIT/dropbox.git/

    Cloning into dropbox...
    done.

Edit Items in the Cloned Repository

volkan@ronin ~/{ProjectPath}/test $ cd dropbox/
volkan@ronin ~/{ProjectPath}/test/dropbox $ vim README.md
volkan@ronin ~/{ProjectPath}/test/dropbox $ git commit -m 'test.'
volkan@ronin ~/{ProjectPath}/test/dropbox $ git add .
volkan@ronin ~/{ProjectPath}/test/dropbox $ git commit -m 'test.'

    [master 1742861] test.
    1 files changed, 1 insertions(+), 1 deletions(-)

Push Items to the Remote Dropbox Repository

volkan@ronin ~/{ProjectPath}/test/dropbox $ git push

    Counting objects: 5, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 283 bytes, done.
    Total 3 (delta 1), reused 0 (delta 0)
    Unpacking objects: 100% (3/3), done.
    To /{DropboxPath}/GIT/dropbox.git/
    ec7b3fb..1742861  master -> master

Pull Items from the Remote Dropbox Repository

volkan@ronin ~/{ProjectPath}/dropbox $ git pull origin master

   remote: Counting objects: 5, done.
   remote: Compressing objects: 100% (2/2), done.
   remote: Total 3 (delta 1), reused 0 (delta 0)
   Unpacking objects: 100% (3/3), done.
   From /{DropboxPath}/GIT/dropbox
   * branch            master     -> FETCH_HEAD
   Updating ec7b3fb..1742861
   Fast-forward
   README.md |    2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment