diff --git a/app/lib/hooks/useGit.ts b/app/lib/hooks/useGit.ts index cfa5027b6..2efc6e8cc 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);