diff --git a/src/lib/git.ts b/src/lib/git.ts index 12a09386..5910f6ff 100644 --- a/src/lib/git.ts +++ b/src/lib/git.ts @@ -1107,7 +1107,8 @@ class GitHttp implements HttpClient { constructor(proxy?: string, fetch?: typeof globalThis.fetch) { this.proxy = proxy; - this.fetch = fetch ?? globalThis.fetch; + // Bind fetch to globalThis to preserve context when called as this.fetch() + this.fetch = fetch ?? globalThis.fetch.bind(globalThis); } async request(request: GitHttpRequest): Promise {