Created
May 6, 2015 20:21
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
+1, someone hire this guy