Gemini CLI Configuration

Gemini CLI Configuration

Updated on June 16

Step 1: Install Git for Windows First

To install Gemini CLI natively on Windows, you need to use Git Bash.

Git for Windows download: Git for Windows Official Website

Download the version for your system and install it with the default options. Verify the installation with this command:

Code block Bash
git --version

Step 2: Install Gemini

After the environment is ready, you can formally install Gemini:

Code block Plain Text
npm install -g @google/gemini-cli

When the installation screen finishes running, that does not mean everything is done. The next step is to check whether the command is actually available. After installation, run the version check again:

Code block Plain Text
gemini --version

This screenshot shows the key verification step after installation. What matters is not whether the interface looks nice, but whether the terminal returns the Gemini version number normally.

Only after this step passes is the local installation truly complete. If you can see the version number, the local installation step is complete.

Step 3: Configure Gemini

Configure Global Variables

  • Open PowerShell and run:
Code block PowerShell / JSON
[Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "YOUR_THIRD_PARTY_API_KEY", "User")
[Environment]::SetEnvironmentVariable("GOOGLE_GEMINI_BASE_URL", "https://rehdasu.cn", "User")
[Environment]::SetEnvironmentVariable("GEMINI_MODEL", "gemini-3.5-flash", "User")

You can also set them through the graphical interface:

Code block Plain Text
Win + R -> enter sysdm.cpl -> Advanced -> Environment Variables -> User variables -> New

Create these variables one by one:

Code block Plain Text
GEMINI_API_KEY
GOOGLE_GEMINI_BASE_URL
GEMINI_MODEL

Configuration Notes

  • GEMINI_API_KEY: replace this with the real key you obtained from the platform.
  • GEMINI_MODEL: replace this with the model name you want to use.

After completing the configuration, restart the CMD window and start using it normally.