post-receive
#!/bin/sh
# 判斷是不是遠端倉庫
IS_BARE=$(git rev-parse --is-bare-repository)
if [ -z "$IS_BARE" ]; then
echo >&2 "fatal: post-receive: IS_NOT_BARE"
exit 1
fi
unset GIT_DIR
DeployPath="/var/www/項目名"
cd $DeployPath
echo "deploying the web"
echo "=== START PULL ==="
git stash
git config --list
# 更新遠程倉庫(local)到master
git pull local master
# git fetch --all
# git reset --hard origin/master
time=`date`
echo "web server pull at webserver at time: $time."
echo "=== END PULL ==="