Bug: core.sshCommand="" causes fatal: unable to fork on git push
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- git, typescript
Research direction
Read packages/core/src/utils/gitUtils.ts and packages/core/src/services/shellExecutionService.ts, focusing on getSafeGitEnv() and defaultGitOverrides. Check how the overrides are tested and reproduce the issue with the provided environment variables and an SSH Git operation. Done means the unsafe empty command overrides are removed or safely replaced, while safe empty overrides remain, and the SSH operation no longer fails with unable to fork.
Written by the indexing model from the issue text.
Description
Bug Report: core.sshCommand="" causes fatal: unable to fork in Gemini CLI
Summary
Gemini CLI's getSafeGitEnv() function sets core.sshCommand (and other config keys) to empty strings via GIT_CONFIG_* environment variables. When Git attempts to use these explicitly-set-but-empty values (e.g., during an SSH push), it tries to execute an empty command, resulting in:
error: cannot run : No such file or directory
fatal: unable to fork
Root Cause
In packages/core/src/utils/gitUtils.ts, getSafeGitEnv() returns:
GIT_CONFIG_KEY_3: 'core.sshCommand',
GIT_CONFIG_VALUE_3: '',
Git treats an explicitly-set config value (even empty) as a command to execute. execvp("", ...) fails with ENOENT, which Git reports as unable to fork.
This was partially recognized in PR #29467 (which removed diff.external=""), but the other empty overrides (core.sshCommand, core.fsmonitor, core.hooksPath, core.editor, sequence.editor) were left in place.
PR #29760 added GIT_SSH_COMMAND: 'ssh -o BatchMode=yes' (which works correctly) but kept the broken core.sshCommand="" override.
Affected Code
packages/core/src/utils/gitUtils.ts—getSafeGitEnv()functionpackages/core/src/services/shellExecutionService.ts—defaultGitOverridesarray
Reproduction
- Set
GIT_CONFIG_KEY_3=core.sshCommandandGIT_CONFIG_VALUE_3=""in the environment. - Run
git pushto a remote that requires SSH. - Git fails with
error: cannot run : No such file or directory→fatal: unable to fork.
Proposed Fix
Remove empty string overrides for config keys that Git treats as executable commands:
core.sshCommandcore.fsmonitorcore.hooksPathcore.editorsequence.editor
Only keep overrides that are safe to set empty (e.g., credential.helper="" resets the helper list without attempting execution).
Alternatively, set these to valid non-empty values that disable the feature safely (e.g., core.sshCommand='true' or omit the override entirely and rely on GIT_SSH_COMMAND env var).
Impact
All Git operations through Gemini CLI that trigger a child process fork (push, pull, fetch with SSH) fail with unable to fork when these empty config values are injected.
- Dominant language
- TypeScript
- Stars
- 109k
- Forks
- 14.9k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 111
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google-gemini/gemini-cli
-
Padded function-call name is answered under the trimmed name, so the next request fails with 400 INVALID_ARGUMENTPossibly taken @arifrhm claimed this 3 days ago. Openarea/agent status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
google-gemini/gemini-cli#30256 · 1 comment ·
Maintainers usually reply within 1 day
-
status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
google-gemini/gemini-cli#30242 · 1 comment ·
Maintainers usually reply within 1 day
-
Auto-update runs npm install -g when a Gemini CLI source checkout is run from outside the clonePossibly taken @tanveerhkit claimed this 4 days ago. Openarea/core effort/small status/bot-triaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
google-gemini/gemini-cli#30209 · 6 comments ·
Maintainers usually reply within 1 day
-
status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
google-gemini/gemini-cli#30127 ·
Maintainers usually reply within 1 day
-
web_fetch keeps a trailing comma on URLs in a comma-separated listMay be free again @tneemo claimed this 24 days ago, and no pull request is open. Openarea/agent status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
google-gemini/gemini-cli#29896 · 2 comments ·
Maintainers usually reply within 1 day
All issues in google-gemini/gemini-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
vercel-labs/ui#809 ·
Maintainers usually reply within 1 day
-
bot:ai-assisted component:platform-js status:untriaged
Difficulty 1/5 Under an hour Newbie friendliness 74/100
midnightntwrk/platform-js#38 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ranxianglei/billion-context#7068 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
mybigday/whisper.rn#348 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
six-group/six-webcomponents#600 ·