diff --git a/apps/server/src/git/Layers/GitCore.test.ts b/apps/server/src/git/Layers/GitCore.test.ts index 8ab541e675..d80406c96d 100644 --- a/apps/server/src/git/Layers/GitCore.test.ts +++ b/apps/server/src/git/Layers/GitCore.test.ts @@ -1023,9 +1023,11 @@ it.layer(TestLayer)("git integration", (it) => { expect(yield* git(source, ["branch", "--show-current"])).toBe("upstream/feature"); const realGitCore = yield* GitCore; let fetchArgs: readonly string[] | null = null; + let fetchEnv: NodeJS.ProcessEnv | undefined; const core = yield* makeIsolatedGitCore((input) => { if (input.args[0] === "--git-dir" && input.args[2] === "fetch") { fetchArgs = [...input.args]; + fetchEnv = input.env; return Effect.succeed({ code: 0, stdout: "", @@ -1049,6 +1051,9 @@ it.layer(TestLayer)("git integration", (it) => { remoteName, `+refs/heads/${featureBranch}:refs/remotes/${remoteName}/${featureBranch}`, ]); + expect(fetchEnv).toEqual({ + SSH_ASKPASS_REQUIRE: "never", + }); }), ); diff --git a/apps/server/src/git/Layers/GitCore.ts b/apps/server/src/git/Layers/GitCore.ts index fb5d908575..1bc12bae2d 100644 --- a/apps/server/src/git/Layers/GitCore.ts +++ b/apps/server/src/git/Layers/GitCore.ts @@ -87,6 +87,7 @@ class StatusUpstreamRefreshCacheKey extends Data.Class<{ interface ExecuteGitOptions { stdin?: string | undefined; + env?: NodeJS.ProcessEnv | undefined; timeoutMs?: number | undefined; allowNonZeroExit?: boolean | undefined; fallbackErrorMessage?: string | undefined; @@ -799,6 +800,7 @@ export const makeGitCore = Effect.fn("makeGitCore")(function* (options?: { cwd, args, ...(options.stdin !== undefined ? { stdin: options.stdin } : {}), + ...(options.env !== undefined ? { env: options.env } : {}), allowNonZeroExit: true, ...(options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {}), ...(options.maxOutputBytes !== undefined ? { maxOutputBytes: options.maxOutputBytes } : {}), @@ -932,6 +934,9 @@ export const makeGitCore = Effect.fn("makeGitCore")(function* (options?: { ["--git-dir", gitCommonDir, "fetch", "--quiet", "--no-tags", upstream.remoteName, refspec], { allowNonZeroExit: true, + env: { + SSH_ASKPASS_REQUIRE: "never", + }, timeoutMs: Duration.toMillis(STATUS_UPSTREAM_REFRESH_TIMEOUT), }, ).pipe(Effect.asVoid);