Skip to content

Instantly share code, notes, and snippets.

@stinoga
Created July 18, 2012 13:47
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stinoga/3136312 to your computer and use it in GitHub Desktop.
Save stinoga/3136312 to your computer and use it in GitHub Desktop.
git post commit hook to push to remote repo
#!/bin/sh
# This hook is used to push a mirrored version of all committed files to your remote repo after they are commited
# 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
# This script needs run in terminal to make your hook file executable. Run it wherever your repo is stored
chmod a+x .git/hooks/post-commit
@samtsai
Copy link

samtsai commented Jul 18, 2012

I think line 11 should read "git push --mirror $REPO"

Very cool.

@stinoga
Copy link
Author

stinoga commented Jul 18, 2012

Ah yes. Thank you sir! All fixed up.

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