google-gemini / google-gemini/gemini-cli
Bug: Background git fetch for private extensions hijacks stdin, causing terminal freeze
- Dominant language
- TypeScript
- Stars
- 107k
- Forks
- 14.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 45
Description
### Description
When a Gemini CLI extension is installed via git from a private repository, the CLI attempts to perform background `git` operations (like `git fetch`) to check for updates on startup. Because the repository is private and requires authentication, the hidden `git` process hangs waiting for a username/password or SSH passphrase.
This hidden `git` process hijacks the terminal's standard input (`stdin`).
**Key Behavior with Flags:**
If launching the CLI from the **terminal** with interactive or prompt flags (e.g., `gemini -p "do something"` or `gemini -i`), the CLI **will successfully run until the end of its first turn** (the AI will generate and display its response). However, once the AI finishes, control is never returned to the user; the terminal remains "frozen" to keyboard input.
**UI Observations During Freeze:**
- The terminal behaves as if it's in "Copy Mode".
- Search (`Ctrl + F`), mouse highlighting/selection, and right-clicking all work normally.
- Standard typing is completely swallowed by the invisible git prompt. The user cannot type anything until the `.git` folder is removed or the git process is manually killed.
### Steps to Reproduce
1. Install an extension via git from a private repository where git will prompt for credentials.
2. Launch `gemini-cli` (with or without flags) from the terminal.
3. Observe that while the AI may complete its first turn, keyboard input is unresponsive for the user.
### Expected Behavior
Background git operations should run non-interactively (e.g., using `GIT_TERMINAL_PROMPT=0 git fetch`) or have their `stdin` detached/piped to `/dev/null` so they fail gracefully on auth errors instead of stealing focus from the user.
### Environment
- OS: Linux
- Gemini CLI
Contributor guide
Assessment
This issue has not been assessed yet.