From 59cae5733db0bb018f37eba0f553cd30d0e8154b Mon Sep 17 00:00:00 2001 From: Anirban Kar Date: Mon, 6 Jan 2025 01:54:55 +0530 Subject: [PATCH] fix: git private clone with custom proxy (#1010) * cookie fix * fix: git private clone with custom proxy * list -fix --- app/lib/hooks/useGit.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/lib/hooks/useGit.ts b/app/lib/hooks/useGit.ts index cfa5027b..2efc6e8c 100644 --- a/app/lib/hooks/useGit.ts +++ b/app/lib/hooks/useGit.ts @@ -50,6 +50,18 @@ export function useGit() { fileData.current = {}; + const headers: { + [x: string]: string; + } = { + 'User-Agent': 'bolt.diy', + }; + + const auth = lookupSavedPassword(url); + + if (auth) { + headers.Authorization = `Basic ${Buffer.from(`${auth.username}:${auth.password}`).toString('base64')}`; + } + try { await git.clone({ fs, @@ -59,6 +71,8 @@ export function useGit() { depth: 1, singleBranch: true, corsProxy: '/api/git-proxy', + headers, + onAuth: (url) => { let auth = lookupSavedPassword(url);