Skip to content

Instantly share code, notes, and snippets.

@svetlio
Created January 28, 2020 09:21
Show Gist options
  • Save svetlio/81a9f76ef54c748fd6ece586da02fb60 to your computer and use it in GitHub Desktop.
Save svetlio/81a9f76ef54c748fd6ece586da02fb60 to your computer and use it in GitHub Desktop.
post-receive script in bare repo hooks to pre-populate code in web-server dir
#!/bin/bash
while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
if [[ "d881" == "$branch" ]]; then
git --work-tree=/var/www/vhosts/fwi.stage/ checkout -f $branch
echo 'Changes pushed d881 branch to fwi.stage'
cp /var/sites-conf/fwi/.htaccess /var/www/vhosts/fwi.stage/web/.htaccess
cp /var/sites-conf/fwi/settings.php /var/www/vhosts/fwi.stage/web/sites/default/settings.php
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment