From 09fca82137fa3f8ee58b13b956f6812f24f8f022 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Tue, 17 Jan 2023 16:50:54 +0100
Subject: [PATCH] fix(git): unset git-hooks after clone (#19880)

---
 lib/util/git/index.ts | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/util/git/index.ts b/lib/util/git/index.ts
index 365b2beaed..33fc5cf430 100644
--- a/lib/util/git/index.ts
+++ b/lib/util/git/index.ts
@@ -426,6 +426,8 @@ export async function syncGit(): Promise<void> {
       const emptyDirAndClone = async (): Promise<void> => {
         await fs.emptyDir(localDir);
         await git.clone(config.url, '.', opts);
+        // unset hooks to avoid post-checkout hooks, etc.
+        await git.raw(['config', '--unset', 'core.hooksPath']);
       };
       await gitRetry(() => emptyDirAndClone());
     } catch (err) /* istanbul ignore next */ {
-- 
GitLab