Skip to content

Instantly share code, notes, and snippets.

@nikosolihin
Created April 20, 2016 07:35
Show Gist options
  • Save nikosolihin/63b1c0fc19aaff935f53f3aafdb393e9 to your computer and use it in GitHub Desktop.
Save nikosolihin/63b1c0fc19aaff935f53f3aafdb393e9 to your computer and use it in GitHub Desktop.
Git post-receive hook
#!/bin/sh
# App directories
APP_WEB_DIR="/home/[godaddy-user]/public_html"
APP_GIT_DIR="/home/[godaddy-user]/git/prod.git/"
# Copy the repo content to the server live directory
git --work-tree=${APP_WEB_DIR} --git-dir=${APP_GIT_DIR} checkout -f
# Clean the app directory (use --exclude=[pattern] to exclude some file)
git --work-tree=${APP_WEB_DIR} clean -fd
# Run composer
cd ${APP_WEB_DIR}
composer install
# Do other things here, for example load database changes automatically
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment