From 7f05a3b4676d7a22becf86c835449e1336f39e8d Mon Sep 17 00:00:00 2001 From: ymq Date: Thu, 20 Aug 2026 00:45:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=5Fensure=5Fproject=5Frepo=20=E5=9C=A8?= =?UTF-8?q?=20git=20init=20=E4=B9=8B=E5=90=8E=E6=89=8D=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E7=BA=A7=20user=EF=BC=88=E5=90=A6=E5=88=99?= =?UTF-8?q?=20git=20config=20=E6=8A=A5=20not=20a=20git=20repository=20?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=88=9D=E5=A7=8B=20commit=20=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_service/agent_loop.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pipeline_service/agent_loop.py b/pipeline_service/agent_loop.py index 00c03cc..abb4d7a 100644 --- a/pipeline_service/agent_loop.py +++ b/pipeline_service/agent_loop.py @@ -742,10 +742,11 @@ async def _ensure_project_repo(workspace_dir): async with _git_lock(repo_dir): if os.path.isdir(os.path.join(repo_dir, '.git')): return {'rc': 0, 'message': '项目过程仓库已存在'} - await _git_setup(repo_dir) r = await _run_shell('git init', repo_dir, 10) if r['rc'] != 0: return {'rc': r['rc'], 'message': f"git init 失败: {r['stderr'][:200]}"} + # init 之后才能配置仓库级 user(否则 git config 报 not a git repository) + await _git_setup(repo_dir) readme = os.path.join(repo_dir, 'README.md') if not os.path.isfile(readme): try: