fix: git private clone with custom proxy (#1010)

* cookie fix

* fix: git private clone with custom proxy

* list -fix
This commit is contained in:
Anirban Kar 2025-01-06 01:54:55 +05:30 committed by GitHub
parent b1f9380c30
commit 59cae5733d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);