What happened?
Hello, the Gemini CLI fails to start when the current working directory is a Git repository. It throws an "Unhandled Promise Rejection" with a GitError, claiming it's not a Git repository, even though it is. The CLI starts correctly if launched from a directory that is not a Git repository.
The issue persists across different Node.js versions (tested on v22.14.0 and v20.19.3).
Install by: npm install -g @google/gemini-cli
All Error & System/Env Information in Client information details
=== Steps to Reproduce ===
1. Create a new directory and navigate into it: mkdir test-dir && cd test-dir
It is normal
2. Initialize a Git repository: git init or git init -b main
3. Attempt to start the Gemini CLI with debug flags: gemini -d
It is Crash
4. If Remove .git directory: rf -rm .git/
It is normal again
and, There should be no .git folders present in any other folders within the path either.
e.g: ~/abc/efg
if abc/ has a .git/
then, in efg/ start gemini cli, It will also crash.
What did you expect to happen?
It should normal work.
Client information
All error, system, and environment information is provided in the details section below.
Details
=== Error Information ===
--- Node.js v20 ---
> gemini -d
[DEBUG] CLI: Delegating hierarchical memory load to server for CWD: /home/cyanflower/search-bot-cs
[DEBUG] [MemoryDiscovery] Loading server hierarchical memory for CWD: /home/cyanflower/search-bot-cs
[DEBUG] [MemoryDiscovery] Searching for GEMINI.md starting from CWD: /home/cyanflower/search-bot-cs
[DEBUG] [MemoryDiscovery] User home directory: /home/cyanflower
[DEBUG] [MemoryDiscovery] Global GEMINI.md not found or not readable: /home/cyanflower/.gemini/GEMINI.md
[DEBUG] [MemoryDiscovery] Determined project root: /home/cyanflower/search-bot-cs
[DEBUG] [MemoryDiscovery] Checking for GEMINI.md in (upward scan): /home/cyanflower/search-bot-cs
[DEBUG] [MemoryDiscovery] Found readable upward GEMINI.md: /home/cyanflower/search-bot-cs/GEMINI.md
[DEBUG] [MemoryDiscovery] Checking for GEMINI.md in (upward scan): /home/cyanflower
[DEBUG] [MemoryDiscovery] Upward GEMINI.md not found or not readable in: /home/cyanflower
[DEBUG] [MemoryDiscovery] Reached ultimate stop directory for upward scan: /home/cyanflower
[DEBUG] [BfsFileSearch] Scanning [1/200]: /home/cyanflower/search-bot-cs
[DEBUG] [BfsFileSearch] Scanning [2/200]: /home/cyanflower/search-bot-cs/Service
[DEBUG] [BfsFileSearch] Scanning [3/200]: /home/cyanflower/search-bot-cs/bin
[DEBUG] [BfsFileSearch] Scanning [4/200]: /home/cyanflower/search-bot-cs/obj
[DEBUG] [MemoryDiscovery] Final ordered GEMINI.md paths to read: ["/home/cyanflower/search-bot-cs/GEMINI.md"]
[DEBUG] [MemoryDiscovery] Successfully read and processed imports: /home/cyanflower/search-bot-cs/GEMINI.md (Length: 110)
[DEBUG] [MemoryDiscovery] Combined instructions length: 181
[DEBUG] [MemoryDiscovery] Combined instructions (snippet): --- Context from: GEMINI.md ---
<system_core_directive>
# Thinking and Output
Thinking in English. Answer in Chinese.
</system_core_directive>
--- End of Context from: GEMINI.md ---...
Flushing log events to Clearcut.
███ █████████ ██████████ ██████ ██████ █████ ██████ █████ █████
░░░███ ███░░░░░███░░███░░░░░█░░██████ ██████ ░░███ ░░██████ ░░███ ░░███
░░░███ ███ ░░░ ░███ █ ░ ░███░█████░███ ░███ ░███░███ ░███ ░███
░░░███ ░███ ░██████ ░███░░███ ░███ ░███ ░███░░███░███ ░███
███░ ░███ █████ ░███░░█ ░███ ░░░ ░███ ░███ ░███ ░░██████ ░███
███░ ░░███ ░░███ ░███ ░ █ ░███ ░███ ░███ ░███ ░░█████ ░███
███░ ░░█████████ ██████████ █████ █████ █████ █████ ░░█████ █████
░░░ ░░░░░░░░░ ░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░
Tips for getting started:
1. Ask questions, edit files, or run commands.
2. Be specific for the best results.
3. /help for more information.
=========================================
CRITICAL: Unhandled Promise Rejection!
=========================================
Reason: GitError: 致命错误:不是 git 仓库(或者任何父目录):.git
at Object.action (file:///home/cyanflower/.local/share/fnm/node-versions/v20.19.3/installation/lib/node_modules/@google/gemini-cli/node_modules/simple-git/dist/esm/index.js:4437:25)
at PluginStore.exec (file:///home/cyanflower/.local/share/fnm/node-versions/v20.19.3/installation/lib/node_modules/@google/gemini-cli/node_modules/simple-git/dist/esm/index.js:4476:25)
at file:///home/cyanflower/.local/share/fnm/node-versions/v20.19.3/installation/lib/node_modules/@google/gemini-cli/node_modules/simple-git/dist/esm/index.js:1338:43
at new Promise (<anonymous>)
at GitExecutorChain.handleTaskData (file:///home/cyanflower/.local/share/fnm/node-versions/v20.19.3/installation/lib/node_modules/@google/gemini-cli/node_modules/simple-git/dist/esm/index.js:1336:16)
at GitExecutorChain.attemptRemoteTask (file:///home/cyanflower/.local/share/fnm/node-versions/v20.19.3/installation/lib/node_modules/@google/gemini-cli/node_modules/simple-git/dist/esm/index.js:1323:42)
at async GitExecutorChain.attemptTask (file:///home/cyanflower/.local/share/fnm/node-versions/v20.19.3/installation/lib/node_modules/@google/gemini-cli/node_modules/simple-git/dist/esm/index.js:1295:18) {
task: {
commands: [ 'rev-parse', '--git-dir' ],
format: 'utf-8',
onError: [Function: onError],
parser: [Function: parser]
}
}
Stack trace may follow:
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ ⠋ Waiting for auth... (Press ESC to cancel) │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯
~/search-bot-cs (csharp-rewrite*) --debugno sandbox (see /docs) gemini-2.5-pro (100% context left)| 145.9 MB
--- Node.js v22 ---
> gemini -d
[DEBUG] CLI: Delegating hierarchical memory load to server for CWD: /home/cyanflower/search-bot-cs
[DEBUG] [MemoryDiscovery] Loading server hierarchical memory for CWD: /home/cyanflower/search-bot-cs
[DEBUG] [MemoryDiscovery] Searching for GEMINI.md starting from CWD: /home/cyanflower/search-bot-cs
[DEBUG] [MemoryDiscovery] User home directory: /home/cyanflower
[DEBUG] [MemoryDiscovery] Global GEMINI.md not found or not readable: /home/cyanflower/.gemini/GEMINI.md
[DEBUG] [MemoryDiscovery] Determined project root: /home/cyanflower/search-bot-cs
[DEBUG] [MemoryDiscovery] Checking for GEMINI.md in (upward scan): /home/cyanflower/search-bot-cs
[DEBUG] [MemoryDiscovery] Found readable upward GEMINI.md: /home/cyanflower/search-bot-cs/GEMINI.md
[DEBUG] [MemoryDiscovery] Checking for GEMINI.md in (upward scan): /home/cyanflower
[DEBUG] [MemoryDiscovery] Upward GEMINI.md not found or not readable in: /home/cyanflower
[DEBUG] [MemoryDiscovery] Reached ultimate stop directory for upward scan: /home/cyanflower
[DEBUG] [BfsFileSearch] Scanning [1/200]: /home/cyanflower/search-bot-cs
[DEBUG] [BfsFileSearch] Scanning [2/200]: /home/cyanflower/search-bot-cs/Service
[DEBUG] [BfsFileSearch] Scanning [3/200]: /home/cyanflower/search-bot-cs/bin
[DEBUG] [BfsFileSearch] Scanning [4/200]: /home/cyanflower/search-bot-cs/obj
[DEBUG] [MemoryDiscovery] Final ordered GEMINI.md paths to read: ["/home/cyanflower/search-bot-cs/GEMINI.md"]
[DEBUG] [MemoryDiscovery] Successfully read and processed imports: /home/cyanflower/search-bot-cs/GEMINI.md (Length: 110)
[DEBUG] [MemoryDiscovery] Combined instructions length: 181
[DEBUG] [MemoryDiscovery] Combined instructions (snippet): --- Context from: GEMINI.md ---
<system_core_directive>
# Thinking and Output
Thinking in English. Answer in Chinese.
</system_core_directive>
--- End of Context from: GEMINI.md ---...
Flushing log events to Clearcut.
███ █████████ ██████████ ██████ ██████ █████ ██████ █████ █████
░░░███ ███░░░░░███░░███░░░░░█░░██████ ██████ ░░███ ░░██████ ░░███ ░░███
░░░███ ███ ░░░ ░███ █ ░ ░███░█████░███ ░███ ░███░███ ░███ ░███
░░░███ ░███ ░██████ ░███░░███ ░███ ░███ ░███░░███░███ ░███
███░ ░███ █████ ░███░░█ ░███ ░░░ ░███ ░███ ░███ ░░██████ ░███
███░ ░░███ ░░███ ░███ ░ █ ░███ ░███ ░███ ░███ ░░█████ ░███
███░ ░░█████████ ██████████ █████ █████ █████ █████ ░░█████ █████
░░░ ░░░░░░░░░ ░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░
Tips for getting started:
1. Ask questions, edit files, or run commands.
2. Be specific for the best results.
3. /help for more information.
=========================================
CRITICAL: Unhandled Promise Rejection!
=========================================
Reason: GitError: 致命错误:不是 git 仓库(或者任何父目录):.git
at Object.action (file:///home/cyanflower/.local/share/fnm/node-versions/v22.14.0/installation/lib/node_modules/@google/gemini-cli/node_modules/simple-git/dist/esm/index.js:4437:25)
at PluginStore.exec (file:///home/cyanflower/.local/share/fnm/node-versions/v22.14.0/installation/lib/node_modules/@google/gemini-cli/node_modules/simple-git/dist/esm/index.js:4476:25)
at file:///home/cyanflower/.local/share/fnm/node-versions/v22.14.0/installation/lib/node_modules/@google/gemini-cli/node_modules/simple-git/dist/esm/index.js:1338:43
at new Promise (<anonymous>)
at GitExecutorChain.handleTaskData (file:///home/cyanflower/.local/share/fnm/node-versions/v22.14.0/installation/lib/node_modules/@google/gemini-cli/node_modules/simple-git/dist/esm/index.js:1336:16)
at GitExecutorChain.attemptRemoteTask (file:///home/cyanflower/.local/share/fnm/node-versions/v22.14.0/installation/lib/node_modules/@google/gemini-cli/node_modules/simple-git/dist/esm/index.js:1323:42)
at async GitExecutorChain.attemptTask (file:///home/cyanflower/.local/share/fnm/node-versions/v22.14.0/installation/lib/node_modules/@google/gemini-cli/node_modules/simple-git/dist/esm/index.js:1295:18) {
task: {
commands: [ 'rev-parse', '--git-dir' ],
format: 'utf-8',
onError: [Function: onError],
parser: [Function: parser]
}
}
Stack trace may follow:
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ ⠋ Waiting for auth... (Press ESC to cancel) │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
~/search-bot-cs (csharp-rewrite*) --debug no sandbox (see /docs) gemini-2.5-pro (100% context left)| 155.7 MB
=== Environment Information: ===
--- OS ---
> uname -a
Linux Cy-Windows-11 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 GNU/Linux
> lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
> cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
--- GEMINI CLI ---
> gemini -v
0.1.9
> npm list -g @google/gemini-cli
/home/cyanflower/.local/share/fnm/node-versions/v20.19.3/installation/lib
└── @google/[email protected]
~/.gemini/settings.json:
{
"theme": "GitHub",
"selectedAuthType": "gemini-api-key",
"preferredEditor": "cursor",
"autoAccept": true,
"checkpointing": {
"enabled": true
}
}
--- Git ---
> git --version
git version 2.39.5
> which -a git
/usr/bin/git
/bin/git
Work directory:
> pwd
/home/cyanflower/search-bot-cs
> git status
位于分支 csharp-rewrite
您的分支与上游分支 'origin/csharp-rewrite' 一致。
无文件要提交,干净的工作区
> git rev-parse --git-dir
.git
--- Node ---
FNM:
> fnm --version
fnm 1.38.1
Node.js v22:
> node -v
v22.14.0
> npm -v
10.9.2
Node.js v20:
> node -v
v20.19.3
> npm -v
10.8.2
Login information
by Gemini API key
Anything else we need to know?
No response
What happened?
Hello, the Gemini CLI fails to start when the current working directory is a Git repository. It throws an "Unhandled Promise Rejection" with a GitError, claiming it's not a Git repository, even though it is. The CLI starts correctly if launched from a directory that is not a Git repository.
The issue persists across different Node.js versions (tested on v22.14.0 and v20.19.3).
Install by: npm install -g @google/gemini-cli
All Error & System/Env Information in Client information details
=== Steps to Reproduce ===
1. Create a new directory and navigate into it:
mkdir test-dir && cd test-dirIt is normal
2. Initialize a Git repository:
git initorgit init -b main3. Attempt to start the Gemini CLI with debug flags: gemini -d
It is Crash
4. If Remove .git directory:
rf -rm .git/It is normal again
and, There should be no .git folders present in any other folders within the path either.
e.g: ~/abc/efg
if abc/ has a .git/
then, in efg/ start gemini cli, It will also crash.
What did you expect to happen?
It should normal work.
Client information
All error, system, and environment information is provided in the details section below.
Details
=== Error Information ===--- Node.js v20 ---
--- Node.js v22 ---
=== Environment Information: ===
--- OS ---
--- GEMINI CLI ---
~/.gemini/settings.json:
{ "theme": "GitHub", "selectedAuthType": "gemini-api-key", "preferredEditor": "cursor", "autoAccept": true, "checkpointing": { "enabled": true } }--- Git ---
Work directory:
--- Node ---
FNM:
Node.js v22:
Node.js v20:
Login information
by Gemini API key
Anything else we need to know?
No response