From ba026a3e56b9f646ae3b1be02dd9c0812aa2f8ae Mon Sep 17 00:00:00 2001 From: Octavian Guzu Date: Thu, 2 Apr 2026 21:52:02 +0100 Subject: [PATCH] Pass env to execFileSync git calls (#1151) Bun's execFileSync without an explicit env option spawns with the process startup environment, dropping runtime process.env mutations. The credential helper reads GH_TOKEN which is set at runtime, so git fetch in the restore-config path failed with empty password. Fixes #1139 :house: Remote-Dev: homespace --- src/github/operations/branch.ts | 2 +- src/github/operations/restore-config.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/github/operations/branch.ts b/src/github/operations/branch.ts index 86197da..bf57f09 100644 --- a/src/github/operations/branch.ts +++ b/src/github/operations/branch.ts @@ -118,7 +118,7 @@ export function validateBranchName(branchName: string): void { * @param args - Git command arguments (e.g., ["checkout", "branch-name"]) */ function execGit(args: string[]): void { - execFileSync("git", args, { stdio: "inherit" }); + execFileSync("git", args, { stdio: "inherit", env: process.env }); } export type BranchInfo = { diff --git a/src/github/operations/restore-config.ts b/src/github/operations/restore-config.ts index 4e12739..a0c06cc 100644 --- a/src/github/operations/restore-config.ts +++ b/src/github/operations/restore-config.ts @@ -48,6 +48,7 @@ export function restoreConfigFromBase(baseBranch: string): void { // caller sees a clean error. execFileSync("git", ["fetch", "origin", baseBranch, "--depth=1"], { stdio: "inherit", + env: process.env, }); // Delete PR-controlled versions. If the restore below fails for a given path,