Skip to content

Commit f0d81a5

Browse files
thecodacusapple
authored andcommitted
fix: git private clone with custom proxy (stackblitz-labs#1010)
* cookie fix * fix: git private clone with custom proxy * list -fix
1 parent ea73342 commit f0d81a5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

app/lib/hooks/useGit.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ export function useGit() {
5050

5151
fileData.current = {};
5252

53+
const headers: {
54+
[x: string]: string;
55+
} = {
56+
'User-Agent': 'bolt.diy',
57+
};
58+
59+
const auth = lookupSavedPassword(url);
60+
61+
if (auth) {
62+
headers.Authorization = `Basic ${Buffer.from(`${auth.username}:${auth.password}`).toString('base64')}`;
63+
}
64+
5365
try {
5466
await git.clone({
5567
fs,
@@ -59,6 +71,8 @@ export function useGit() {
5971
depth: 1,
6072
singleBranch: true,
6173
corsProxy: '/api/git-proxy',
74+
headers,
75+
6276
onAuth: (url) => {
6377
let auth = lookupSavedPassword(url);
6478

0 commit comments

Comments
 (0)