#!/bin/bash ###################################################################### # # Put this file in your gitolite-admin; # ~/gitolite-admin/local/hooks/repo-specific/hook-deployweb # while read oldrev newrev refname do BRANCH=$(git rev-parse --symbolic --abbrev-ref $refname) echo "Commit was for branch $BRANCH" if [[ "$BRANCH" == "master" ]];then # Get project name from current directory (without .git) PROJECT=$(basename "$PWD") PROJECT=${PROJECT%.git} echo "Project $PROJECT added to deploy list." echo $PWD > /srv/gitolite/deploy/$PROJECT fi done