From e56fb36ad3b92939c72b56382e31f569759d1d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B0=8F=E4=BA=91?= Date: Fri, 9 Jan 2026 18:15:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=20runtime=20=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=B7=B2=E5=AD=98=E5=9C=A8=E4=BD=86=E4=B8=8D=E6=98=AF?= =?UTF-8?q?=20Git=20=E4=BB=93=E5=BA=93=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .devops/deployer.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.devops/deployer.py b/.devops/deployer.py index 0fa1d78..fbdc0e1 100644 --- a/.devops/deployer.py +++ b/.devops/deployer.py @@ -71,8 +71,16 @@ class Deployer: # 直接使用 runtime_path 作为仓库路径 repo_path = self.runtime_path - if not repo_path.exists() or not (repo_path / '.git').exists(): + # 检查是否是有效的 Git 仓库 + if not (repo_path / '.git').exists(): self.logger.info("主仓库不存在,开始克隆...") + + # 如果目录存在但不是 Git 仓库,先删除 + if repo_path.exists(): + self.logger.warning(f"目录 {repo_path} 已存在但不是 Git 仓库,将被删除") + shutil.rmtree(repo_path) + + # 确保父目录存在 repo_path.parent.mkdir(parents=True, exist_ok=True) # 克隆到 runtime 目录