Gemini CLI Hangs on Startup Over SSH: Locked Keychain Fix
Gemini CLI freezes with no error over SSH? Set GEMINI_FORCE_FILE_STORAGE=true to bypass a locked keychain. Includes a 60-second test and 429 notes.
GuideUpdated 6 min read
On this page
You log in to a server, type gemini, and nothing happens. No error, no spinner that ends, no output. gemini -p "hello" freezes the same way, and so does the sign-in step.
Why it happens
The report behind this article was Gemini CLI 0.37.1 on Ubuntu. Interactive prompts, -p, and the OAuth flow all hung silently. Reinstalling, resetting config and updating changed nothing. This comes from a single user thread, not from Gemini CLI's documentation, and we haven't reproduced it.
The explanation given in that thread: the machine was reached over SSH, so its default keychain was locked, and Gemini CLI sat waiting on it. A desktop login normally unlocks the keychain for you. An SSH session has no such unlock step, so anything that asks the keychain for a credential can block without printing anything.
The signature to look for:
gemini --versionandgemini --helpprint normally (they never touch stored credentials).- Any real prompt,
gemini -p "hello", or sign-in freezes with no output. - The network is fine; other tools reach the internet from the same machine.
- You reached the machine over SSH: a VPS, a VM, a box under your desk.
Step 1: run a 60-second test
Set the variable for a single command. timeout 60 ends it if it still hangs:
GEMINI_FORCE_FILE_STORAGE=true timeout 60 gemini -p "say hello"If you get an answer, the keychain is your problem. If it hangs the full 60 seconds, jump to "If it still hangs".
Step 2: set the variable for the session
export GEMINI_FORCE_FILE_STORAGE=true
geminiThis lasts until you close the SSH session. By its name, the variable makes Gemini CLI keep credentials in a file instead of the system keychain. We haven't verified where that file lives or how it is protected, so read Gemini CLI's own documentation before relying on it on a shared machine. If Gemini asks you to sign in, do it with the variable still set.
Step 3: make it permanent
On Ubuntu, bash is the default shell. Append the line to ~/.bashrc and load it:
echo 'export GEMINI_FORCE_FILE_STORAGE=true' >> ~/.bashrc
source ~/.bashrcThe first command adds the export; the second loads it into the current session. To undo it, delete that line from ~/.bashrc and run unset GEMINI_FORCE_FILE_STORAGE. If your server uses zsh, edit ~/.zshrc instead. Check with echo $SHELL.
When the variable doesn't reach Gemini
Check in the session where Gemini runs:
echo $GEMINI_FORCE_FILE_STORAGEIt should print true. If it prints nothing, the shell that launched Gemini never read your line. Ubuntu's default ~/.bashrc returns early in non-interactive shells, so a line appended at the bottom is never reached. That affects one-shot commands such as ssh host gemini -p "...", and some scripts and service launchers. Either move the export above that early return, or set the variable on the command itself:
ssh host 'GEMINI_FORCE_FILE_STORAGE=true gemini -p "say hello"'Cause, symptom and fix at a glance
| Cause | Symptom | Fix |
|---|---|---|
| Locked keychain in an SSH session | Prompt and sign-in hang, --version works | Set GEMINI_FORCE_FILE_STORAGE=true |
| Variable set in the wrong profile | Still hangs after editing a file | Use ~/.zshrc for zsh, ~/.bashrc for bash |
Non-interactive shell skips .bashrc | Works by hand, hangs in ssh host cmd | Set it on the command, or move the export up |
| Old session | Edit made, no effect | Log out and back in, or source the profile |
| Something else | One-off test also hangs 60 s | File an issue with Gemini CLI's developers |
If you run Gemini CLI through Sledbot
Sledbot can run Gemini CLI in a terminal on an SSH machine, which is the situation in the report. We make Sledbot, so here is what it does and doesn't cover:
- It does not fix this hang. There is no Sledbot setting for
GEMINI_FORCE_FILE_STORAGE, and we haven't tested whether the hang happens inside Sledbot. The fix is the environment variable in the remote shell profile, as above. - It gives you places to set it. Open Machines… in the sidebar, then More actions ▸ Open shell on the machine's card, and edit the profile there. New task also has an Environment field under Advanced that takes
KEY=valuelines. We haven't verified that it reaches agents on remote machines. To check, start a Shell agent on that machine and runecho $GEMINI_FORCE_FILE_STORAGE. - It may flag the hang. Sledbot's Health check reports an agent as stuck when it has no output for 10 minutes and no CPU use. The banner offers Send a nudge or Restart with resume, which don't address the cause.
- It can run the sign-in on that machine. In Settings ▸ Agents, pick the machine and use Log in… next to Gemini CLI. Set the variable on the machine first.
As of November 2026, the Sledbot app doesn't bundle its Linux engine, so adding a Linux machine that doesn't already have ~/.sledbot/bin/sled fails during setup. Another Mac works. See Run agents on your own servers and Troubleshooting Sledbot.
If it still hangs
- Run
echo $GEMINI_FORCE_FILE_STORAGEin the exact session where Gemini runs. - Confirm you edited the right profile for your shell.
- Log out and back in so the profile reloads.
- If the hang is at sign-in, set the variable, run
geminiinteractively and sign in again. - If the 60-second test also hangs, the keychain isn't the cause. Check Gemini CLI's official documentation and report it to its developers.
"Resource Exhausted" 429 and "Limit: 0"
Once the hang is gone, some people hit a 429 "Resource Exhausted" error mentioning Limit: 0. A commenter in the same thread explained it as a billing mismatch: a Google One subscription and Google AI Studio (API) billing are separate. We haven't verified this.
Gemini CLI's site lists these free quotas (as of November 2026):
| Sign-in route | Limits |
|---|---|
| Personal Google account | 60 requests per minute, 1,000 per day |
| Gemini API key (free tier) | 250 requests per user per day, 10 per minute, Flash models only |
Beyond that you pay through the Gemini API, Vertex AI, or an organization license. If you see Limit: 0, check whether the CLI is using account sign-in or an API key, and what billing exists for that route.
Checklist before you try again
gemini --versionworks but a prompt hangs.- You are connected over SSH.
echo $GEMINI_FORCE_FILE_STORAGEprintstruein that session.- The line is in the profile your shell actually reads.
- You signed in again with the variable set.
If nothing works
Contact Gemini CLI's developers through their project's issue tracker. Include the output of gemini --version, your OS and version, how you connect, the exact command that hangs, and the result of the 60-second test.
Gemini CLI hangs with no error on a machine reached over SSH.
Version: (output of gemini --version)
OS: (e.g. Ubuntu 24.04)
Symptom: --version and --help work; gemini and gemini -p "hello" hang; sign-in also hangs.
Tried: GEMINI_FORCE_FILE_STORAGE=true timeout 60 gemini -p "say hello" -> (result)
Also tried: reinstall, config reset, update.Common questions
Is it safe to leave GEMINI_FORCE_FILE_STORAGE on?
By its name it keeps credentials in a file instead of the keychain. Read Gemini CLI's documentation on where that file lives and how it is protected before leaving it on a shared server. To go back, remove the line and run unset GEMINI_FORCE_FILE_STORAGE.
Why do --version and --help still work?
They don't need stored credentials, so they never touch the keychain. Only commands that load or save a login block.
Will updating or reinstalling help?
In the report it didn't. Setting the variable did.