#!/bin/bash
echo ""
#输出当前时间
date --date='0 days ago' "+%Y-%m-%d %H:%M:%S"
echo "Start"
#判断宝塔WebHook参数是否存在
if [ ! -n "$1" ];
then
          echo "param参数错误"
          echo "End"
          exit
fi
#git项目路径
gitPath="/www/wwwroot/$1"
#git 网址
gitHttp="git@e.coding.net:gantoday/$1.git"

echo "Web站点路径:$gitPath"

#判断项目路径是否存在
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

  https://blog.csdn.net/qq_42693512/article/details/87918272

  https://blog.csdn.net/qq_37868757/article/details/103838513

相关文章:

  • 2021-08-02
  • 2022-12-23
  • 2021-12-24
  • 2021-06-07
  • 2021-07-23
  • 2021-12-03
  • 2021-11-09
猜你喜欢
  • 2019-09-14
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2021-06-28
  • 2021-06-13
相关资源
相似解决方案