Skip to content

Commit ba026a3

Browse files
authored
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 🏠 Remote-Dev: homespace
1 parent c95e735 commit ba026a3

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/github/operations/branch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export function validateBranchName(branchName: string): void {
118118
* @param args - Git command arguments (e.g., ["checkout", "branch-name"])
119119
*/
120120
function execGit(args: string[]): void {
121-
execFileSync("git", args, { stdio: "inherit" });
121+
execFileSync("git", args, { stdio: "inherit", env: process.env });
122122
}
123123

124124
export type BranchInfo = {

src/github/operations/restore-config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export function restoreConfigFromBase(baseBranch: string): void {
4848
// caller sees a clean error.
4949
execFileSync("git", ["fetch", "origin", baseBranch, "--depth=1"], {
5050
stdio: "inherit",
51+
env: process.env,
5152
});
5253

5354
// Delete PR-controlled versions. If the restore below fails for a given path,

0 commit comments

Comments
 (0)