post-receive (Source)

1
2
3
4
5
6
7
8
#!/bin/bash
while read oldrev newrev refname
do
  branch=$(git rev-parse --symbolic --abbrev-ref $refname)
  if [ "master" == "$branch" ]; then
    git push origin master
  fi
done