Skip to content

Commit

Permalink
fix: git private clone with custom proxy (stackblitz-labs#1010)
Browse files Browse the repository at this point in the history
* cookie fix

* fix: git private clone with custom proxy

* list -fix
  • Loading branch information
thecodacus authored Jan 5, 2025
1 parent b1f9380 commit 59cae57
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/lib/hooks/useGit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -59,6 +71,8 @@ export function useGit() {
depth: 1,
singleBranch: true,
corsProxy: '/api/git-proxy',
headers,

onAuth: (url) => {
let auth = lookupSavedPassword(url);

Expand Down

0 comments on commit 59cae57

Please sign in to comment.