简洁 在hook脚本中使用$1接收
echo ""
date --date='0 days ago' "+%Y-%m-%d %H:%M:%S"
echo "-------开始-------"
gitPath="/www/wwwroot/$1"
cd $gitPath
git reset --hard origin/master
git clean -f
cat `git pull origin master`
cat `git pull origin master`
chown -R www.www .
echo "拉取完成"
完整 在hook脚本中使用$1接收
echo ""
date --date='0 days ago' "+%Y-%m-%d %H:%M:%S"
echo "-------开始-------"
if [ ! -n "$1" ];
then
echo "param参数错误"
echo "End"
exit
fi
gitPath="/www/wwwroot/$1"
gitHttp="git@gitee.com:qxiangkj_0/$1.git"
echo "路径:$gitPath"
if [ -d "$gitPath" ]; then
cd $gitPath
if [ ! -d ".git" ]; then
echo "在该目录下克隆 git"
git clone $gitHttp gittemp
mv gittemp/.git .
rm -rf gittemp
fi
git reset --hard origin/master
git pull origin master
echo "拉取完成"
chown -R www:www $gitPath
echo "-------结束--------"
exit
else
echo "该项目路径不存在"
echo "End"
exit
fi
|