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 ==="
网友评论