Skip to content

Instantly share code, notes, and snippets.

@stinoga
Created August 13, 2012 12:25
Show Gist options
  • Save stinoga/3340157 to your computer and use it in GitHub Desktop.
Save stinoga/3340157 to your computer and use it in GitHub Desktop.
Use Dropbox as a git repo
#!/bin/sh
# This hook is used to push a mirrored version of all committed files to your dropbox repo after they are commited (optional)
# Replace this variable with your remote repo name
REPO=dropbox
echo
echo "==== Sending changes to $REPO repo ===="
echo
git push --mirror $REPO;
echo
echo "==== Donezo ===="
echo
# Make the repo folder in Dropbox
cd ~/Dropbox
mkdir gitRepos
# Create the git repo (replace repoName with whatever you want to name it)
mkdir repoName.git
cd repoName.git
git --bare init
# Add new remote to your git repo named dropbox
cd ~/Sites/repoName
git remote add dropbox file:///$HOME/Dropbox/gitRepos/repoName.git
git push dropbox master
# You can clone the repo on another machine like so
# This will also create a dropbox remote for this new clone
git clone -o dropbox file:///$HOME/Dropbox/gitRepos/repoName.git
# pulling from the repo on another machine
git pull dropbox <branchName>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment