Skip to content

Instantly share code, notes, and snippets.

@naimkhalifa
Created June 12, 2017 15:57
Show Gist options
  • Save naimkhalifa/8863a6202b0c010f9a547a5c4f79b92b to your computer and use it in GitHub Desktop.
Save naimkhalifa/8863a6202b0c010f9a547a5c4f79b92b to your computer and use it in GitHub Desktop.
Simple git post-receive hook for OVH shared hosting config
#!/bin/bash
working_dir_base="/homez.172/nomdutilisateur/www/_sites/monsite.git"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
echo "Starting deployment..."
GIT_WORK_TREE=$working_dir_base git checkout $branch -f
NOW=$(date +"%Y%m%d-%H%M")
git tag release_$NOW $branch
echo " /==============================="
echo " | Target branch: $branch"
echo " | Target folder: $working_dir_base"
echo " \=============================="
echo "done !"
done
#more info at http://www.codeur.co/configurer-git-pour-d%C3%A9ployer-sur-un-mutualis%C3%A9-ovh (fr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment