WebHook钩子

webhooks整理
码云创建远程仓库
生成公钥


服务器配置webhooks

#!/bin/bash
echo ""
#输出当前时间
date --date='0 days ago' "+%Y-%m-%d %H:%M:%S"
echo "Start"
#git项目路径
gitPath="/www/wwwroot/XJ/FastAdmin/51fa/"
#git 网址
gitHttp="https://gitee.com/duosheng_network/51fa.git"

echo "Web站点路径:$gitPath"
echo "上传人:$1"

#判断项目路径是否存在
if [ -d "$gitPath" ]; then
cd $gitPath
#判断是否存在git目录
if [ ! -d ".git" ]; then
echo "在该目录下克隆 git"
git clone $gitHttp gittemp
mv gittemp/.git .
rm -rf gittemp
fi
#拉取最新的项目文件
git reset --hard origin/master
git pull
#设置目录权限
chown -R www:www $gitPath
echo "End"
exit
else
echo "该项目路径不存在"
echo "End"
exit
fi

gitpath路径中应有.git

本地配置git
设置并连接git仓库

猜你喜欢

转载自www.cnblogs.com/xuanjiange/p/11766373.html