How To Set hooks/post-receive in Git Bare Repository for Automated Live Deployed

Create a hooks/post-receive and make it Executable:

cd path/To/YourDomain.git
touch hooks/post-receive
chmod +x hooks/post-receive
nano hooks/post-receive

Insert something like the Code below:

#!/bin/bash
#CONFIG
LIVE="/path/To/Your/liveRepo"

read oldrev newrev refname
if [ $refname = "refs/heads/master" ]; then
 echo "************* DEPLOYING TO LIVE SITE ******************"
 unset GIT_DIR
 cd $LIVE
 git pull origin master
 echo "********************* DONE ****************************"
fi

Now when you execute from your Local Domain:

git push origin master

You should perceive after a wile the Notice telling you the Deployment has been:

************* DEPLOYING TO LIVE SITE ******************
noErrorsMessages...
********************* DONE ****************************

The Set-up is Tricky and is enough to make a little Typo to make it useless...

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer