Skip to content

Instantly share code, notes, and snippets.

@lnpbk
Last active August 29, 2015 13:56
Show Gist options
  • Save lnpbk/9089160 to your computer and use it in GitHub Desktop.
Save lnpbk/9089160 to your computer and use it in GitHub Desktop.
Post receive hook v0.1
#!/bin/sh
USERNAME="user";
GROUPNAME="www-data";
WORKDIR="/path/to/git/root";
# Checkout the latest commit
GIT_WORK_TREE=${WORKDIR} git checkout -f
# Set file owner
sudo chown -R ${USERNAME}:${GROUPNAME} ${WORKDIR};
# Very time consuming
# http://ryansechrest.com/2013/08/managing-file-and-folder-permissions-when-deploying-with-git/
# find ${WORKDIR} -type d -exec sudo chmod -R 775 {} \;
# find ${WORKDIR} -type f -exec sudo chmod 664 {} \;
# Install dependencies
cd ${WORKDIR}/htdocs;
composer install --no-dev --prefer-dist;
# Run Laravel migrations
php artisan migrate --env=test;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment