Skip to content

Instantly share code, notes, and snippets.

@AubreyHewes
Forked from vrillusions/README
Created October 31, 2012 09:22
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 AubreyHewes/3986055 to your computer and use it in GitHub Desktop.
Save AubreyHewes/3986055 to your computer and use it in GitHub Desktop.
Use bitbucket as a private offsite code backup (edited)
Now that bitbucket supports git, it's easy to use their service as a free, private, offsite code backup. Just create an empty repo for your project on bitbucket, add it as a remote to your development repo:
username@host:~/project$ git remote add bitbucket https://username@bitbucket.org/username/project.git
### initial push of something in order for the mirror to succeed
username@host:~/project$ git push bitbucket master
The mirror command only works after the remote has been initially filled.
Use this post-commit hook to silently and automatically push your changes up after each commit.
#!/bin/sh
# The mirror option will automatically push all branches/tags (even ones not pushed to github)
git push -q --mirror bitbucket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment