Skip to content

Instantly share code, notes, and snippets.

@t2k
Created May 6, 2015 20:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t2k/9cefb6004d95519cc9fc to your computer and use it in GitHub Desktop.
Save t2k/9cefb6004d95519cc9fc to your computer and use it in GitHub Desktop.
my post-update (hook) How to deploy a website via a shared repo.
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
#
# ie: git push default_test MyNewBranch
# $1 would equal refs/heads/MyNewBranch
# and $branch = MyNewBranch
branch=$(git rev-parse --symbolic --abbrev-ref $1) || "master"
echo pushed to remote: default_test branch: $branch
# change to working directory for our TEST/DEVELOPMENT SITE
cd /cygdrive/c/inetpub/wwwroot/default_test || exit
# remember we are
# executing from the post-update hook of the --bare repo
# need to unset the ENV to pull the --bare into the working directory
unset GIT_DIR
echo "#### Pulling changes into default_test working directory ####"
# must define a remote as hub that points to the --bare repo
# ie git remote add hub ~/test_hub.git
# $branch is from line 11 above
# http://stackoverflow.com/questions/7331519/find-git-branch-name-in-post-update-hook
git pull hub $branch
echo DONE: pulled $branch into /inetpub/wwwroot/default_test
exec git update-server-info
@xjackk
Copy link

xjackk commented May 6, 2015

+1, someone hire this guy

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