Skip to content

Instantly share code, notes, and snippets.

@pmeulen
Last active November 26, 2018 12:33
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 pmeulen/97d672077ec71642f7fa82f3cb001123 to your computer and use it in GitHub Desktop.
Save pmeulen/97d672077ec71642f7fa82f3cb001123 to your computer and use it in GitHub Desktop.
Create a brare git repository in dropbox that can be used as a remote

It is possible to use Dropbox as a "remote" repository. It is not perfect, updating or pushing to the remote from two location simultaniously will surely corrupt the repository. That being said it is a practical trick for syncing repositories between computers without both having write access to "origin" (i.e. github, gitlab or the like).

I store the repositories in a directory "git" in my dropbox folder. Create it if it does not yet exist, or make up you own name: mkdir ~/Dropbox/git/

  1. Change to the repository for which you want to create a remote

cd /path/of/your/repository

  1. Initialise the git repository in the Dropbox shared folder

git init --bare ~/Dropbox/git/repository-name.git

  1. Add the new repository as a remote

git remote add Dropbox ~/Dropbox/git/repository-name.git

  1. Push all branches to the new remote

git push Dropbox --all

Now on another computer wait until Dropbox has finished syncing, then add Dropbox as a remote again (see step 3). You can then fetch and pull from Dropbox and push to origin. Yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment