setupmasterpush (Source)

# This script is used to setup the repository to push code
# from the master branch only to the "Production" server.
# This script assumes the following:
# 1) Gitolite is installed
# 2) There is a gitolite user and
# 3) There is a /home/gitolite/repositories directory
# 4) There is a /home/gitolite/support directory and the
#    post-receive file is there

# Make sure you change the <hostname> parameter

# Set up the default parameters

read -e -p "Enter the Project name:" -i "" PROJECT

if [ -z "$PROJECT" ]; then
  echo "Project name cannot be blank!"

cd /home/gitolite/repositories/$PROJECT.git

cp ../../support/post-receive hooks/.
chmod ug+x hooks/post-receive

git remote add origin $HOSTNAME:repositories/$PROJECT.git

git push -u origin master