Skip to content

Instantly share code, notes, and snippets.

@joshcummingsdesign
Last active June 11, 2018 18: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 joshcummingsdesign/053a522238c71ab82cd4 to your computer and use it in GitHub Desktop.
Save joshcummingsdesign/053a522238c71ab82cd4 to your computer and use it in GitHub Desktop.
Git post-receive hook
#!/bin/bash
git --work-tree=<site-directory> --git-dir=<git-repo> checkout -f
@joshcummingsdesign
Copy link
Author

joshcummingsdesign commented Nov 19, 2015

How to Use

  • Run mkdir example.git
  • Run cd example.git
  • Run git init --bare
  • Run nano hooks/post-receive
  • Paste in the code
  • Replace <site-directory> with the full path to the working tree
  • Replace <git-repo> with the full path to example.git
  • Run chmod +x hooks/post-receive

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