From 69bdaf01133b88d5194ffd94519ae17b5faa9622 Mon Sep 17 00:00:00 2001 From: Darian Date: Fri, 16 Oct 2026 16:33:28 +0330 Subject: [PATCH] Clear stale git lock files before production checkout fetch. Interrupted shallow fetches leave shallow.lock and block the next deploy. Co-authored-by: Cursor --- .gitea/workflows/deploy.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 54ff557..bfa10fb 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -27,6 +27,13 @@ jobs: git -C "$TARGET" init git -C "$TARGET" remote add origin "http://127.0.0.1:8301/$REPO_NAME.git" fi + # Clear stale locks from interrupted shallow fetches (common after crash/timeout). + # This checkout is deploy-only; concurrency group already serializes jobs. + rm -f \ + "$TARGET/.git/shallow.lock" \ + "$TARGET/.git/index.lock" \ + "$TARGET/.git/HEAD.lock" \ + "$TARGET/.git/config.lock" # Supply the job token only for fetch; never store it in .git/config. AUTH=$(printf '%s:%s' "$REPO_ACTOR" "$REPO_TOKEN" | base64 -w0) git -C "$TARGET" -c "http.extraHeader=Authorization: Basic $AUTH" fetch --depth=1 origin "$DEPLOY_SHA"