From c90aee374bd11d85957a0e5186316bd2210fe38c Mon Sep 17 00:00:00 2001 From: hellcat <> Date: Mon, 30 Jun 2025 17:21:22 +0800 Subject: [PATCH] no message --- app/Http/Controllers/CronController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/CronController.php b/app/Http/Controllers/CronController.php index a7ce5bd..9127a94 100755 --- a/app/Http/Controllers/CronController.php +++ b/app/Http/Controllers/CronController.php @@ -161,14 +161,14 @@ class CronController // 检查文件是否存在,如果不存在则创建 if (!file_exists($sshConfigFile)) { -// touch($sshConfigFile); + touch($sshConfigFile); } // 追加配置到文件 file_put_contents($sshConfigFile, $config, FILE_APPEND | LOCK_EX); // 设置文件权限 -// chmod($sshConfigFile, 0600); + chmod($sshConfigFile, 0600); echo "SSH config updated successfully.\n"; @@ -221,6 +221,10 @@ class CronController // 添加远程仓库 $this->runCommand("git remote add origin \"{$this->sProjectUrl}\""); + // 立即拉取覆盖一次 + $this->runCommand("git fetch origin"); + $this->runCommand("git reset --hard origin/main"); + echo "操作完成:以初始化仓库[".$this->aArticle['id']."]。\n"; }