Enable Gemini CLI to reuse user's auth in Cloud Shell (#3070)

This commit is contained in:
Marat Boshernitsan
2025-07-07 15:02:13 -07:00
committed by GitHub
parent 357546a2aa
commit 48c2aa296a
10 changed files with 211 additions and 32 deletions

View File

@@ -74,6 +74,10 @@ The Gemini CLI requires you to authenticate with Google's AI services. On initia
echo 'export GOOGLE_GENAI_USE_VERTEXAI=true' >> ~/.bashrc
source ~/.bashrc
```
4. **Cloud Shell:**
- This option is only available when running in a Google Cloud Shell environment.
- It automatically uses the credentials of the logged-in user in the Cloud Shell environment.
- This is the default authentication method when running in Cloud Shell and no other method is configured.
### Persisting Environment Variables with `.env` Files

View File

@@ -248,6 +248,7 @@ The CLI automatically loads environment variables from an `.env` file. The loadi
- Your Google Cloud Project ID.
- Required for using Code Assist or Vertex AI.
- If using Vertex AI, ensure you have the necessary permissions and set the `GOOGLE_GENAI_USE_VERTEXAI=true` environment variable.
- **Cloud Shell Note:** When running in a Cloud Shell environment, this variable defaults to a special project allocated for Cloud Shell users. If you have `GOOGLE_CLOUD_PROJECT` set in your global environment in Cloud Shell, it will be overridden by this default. To use a different project in Cloud Shell, you must define `GOOGLE_CLOUD_PROJECT` in a `.env` file.
- Example: `export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"`.
- **`GOOGLE_APPLICATION_CREDENTIALS`** (string):
- **Description:** The path to your Google Application Credentials JSON file.