Gemini CLI Authentication & Data Handling (as of 01 Aug 2026)

Grading note. A dated snapshot — accurate as of 01 Aug 2026, frozen here and kept as a permanent archive entry. Research-drafted by a pupil, graded by the 3-lens panel + sensei. Corrections applied inline; unverifiable gaps marked ⚠ PENDING (#issue) — never guessed.

Prerequisite: Gemini CLI is Google’s open-source, terminal-based AI coding agent, installed with npm install -g @google/gemini-cli (requires Node.js). This entry assumes it’s installed and walks through picking and protecting an authentication method.

How to read the labels


Practice: Know that personal “Login with Google” OAuth on free/Pro/Ultra accounts no longer works in the open-source gemini CLI (Workspace/enterprise OAuth still does)

Do: Before following any tutorial that tells you to run gemini and click “Login with Google” on a free, Google AI Pro, or Google AI Ultra personal account, check that it still applies. Google retired that path in the open-source gemini CLI on 18 June 2026; Google announced the change on 19 May 2026 and gave a ~30-day migration window. The replacement product is Antigravity CLI — binary agy, closed-source — a separate tool with its own auth (env var ANTIGRAVITY_API_KEY; as of this writing a maintainer has stated a Gemini API key is not currently supported as an alternative) and quota model. Personal-account OAuth login continues to fail with no grace period for scripts/cron jobs/CI that still call gemini. Why (beginner): Most existing blog posts, videos, and even some cached docs still show “Login with Google” as the default, easiest option. If you’re new and just installed gemini-cli today, that flow may simply not authenticate for a personal account — you are not doing anything wrong. Caveat / contested: Access is not cut off for everyone: organizations with a Gemini Code Assist Standard/Enterprise license, Google Cloud/Vertex AI users, and anyone authenticating with a paid Gemini API key still get full gemini-cli access. 🕒 verify live — Google has not published an end date for that enterprise/API-key access window, so check current status before relying on it long-term. Re-checked live 01 Aug 2026: no reversal or extension found; the cutoff still stands. Sources: github.com/google-gemini/gemini-cli discussion #27274 (official Google announcement) (19 May 2026) · developers.googleblog.com — An important update: transitioning Gemini CLI to Antigravity CLI (19 May 2026, primary source) · inventivehq.com — Gemini CLI Is Being Retired on June 18 (13 Jun 2026) · securityonline.info — Gemini CLI Deprecation (22 Jun 2026) · github.com/google-antigravity/antigravity-cli issue #78 (confirms ANTIGRAVITY_API_KEY, binary agy) Confidence: independently-corroborated


Practice: Choose your auth path based on who’s paying, not just convenience

Do: Gemini CLI currently supports three auth families: (1) Sign in with Google — for individual accounts (works today mainly for Workspace/company/school accounts and Code Assist Standard/Enterprise licenses, per the practice above), (2) a Gemini API key from Google AI Studio — set it with export GEMINI_API_KEY=your-key-here (Linux/macOS) or the equivalent for your shell, no Cloud project required — with separate free and paid quota, and (3) Vertex AI (Application Default Credentials via gcloud, a service-account JSON key, or a Cloud API key), which requires a GCP project with billing/Vertex AI API enabled. Pick API key or Vertex AI if you want a documented, billing-gated privacy posture; pick Workspace/enterprise OAuth if your org already manages Code Assist licensing. Why (beginner): These three paths aren’t interchangeable conveniences — each one carries a different Terms of Service and Privacy Notice (see the data-handling practice below), so “which auth do I pick” is really “whose privacy terms do I accept.” Caveat / contested: Vertex AI setup is a multi-step Cloud Console/gcloud process, not something you do in one command — install the gcloud CLI, run gcloud auth application-default login, create or select a GCP project, enable billing and the Vertex AI API, then assign the Vertex AI User IAM role to your account/service account, and set the GOOGLE_CLOUD_PROJECT/GOOGLE_CLOUD_LOCATION env vars — see Google’s Vertex AI quickstart if you want this path. It’s overkill for casual/personal use and is aimed at CI/CD and enterprise deployments. 🕒 verify live — daily/rate quotas per path change; the current free API key tier was 250 requests/day, Flash-model-only, at time of writing (re-confirmed live 01 Aug 2026 against the vendor quota page). Sources: geminicli.com/docs/get-started/authentication (fetched 01 Aug 2026) · geminicli.com/docs/resources/quota-and-pricing (fetched 01 Aug 2026) Confidence: vendor-documented


Practice: Treat the free/unpaid tier as “Google can use this to train models and humans may read it” — don’t paste sensitive code there

Do: Under Google’s Gemini API Additional Terms of Service, Unpaid Services (Google AI Studio, and the unpaid quota of the Gemini API — which is what an un-billed personal API key or free Code Assist login uses) let Google “use the content you submit … and any generated responses to provide, improve, and develop Google products and services and machine learning technologies,” and “human reviewers may read, annotate, and process” your inputs/outputs (Google says it disconnects this from your account/API key/project first). The terms explicitly instruct: don’t submit sensitive, confidential, or personal information to Unpaid Services. Once you enable a Cloud Billing account, all use of the Gemini API and AI Studio becomes a “Paid Service” for data-handling purposes — even calls that don’t cost money — and Google states “Google doesn’t use your prompts or responses to improve our products,” with prompts/responses logged only temporarily for abuse detection/legal compliance. Why (beginner): If you’re pasting real client code, private repos, or anything under an NDA into gemini-cli, this is the single most important fact to check first: are you on a billing-enabled (paid) project, or the free quota? The free path is fine for learning and public/toy code; it’s not designed for confidential work. Caveat / contested: If you’re in the European Economic Area, Switzerland, or the UK, Google applies the paid-tier (“no training”) data terms to all services, including the free/unpaid tier, as a regional commitment — so the free-tier training risk described above mainly applies outside those regions. Also note: enabling billing is what flips the switch, not simply “having a paid subscription” — see the next practice for a documented gap around Google AI Pro/Ultra personal subscriptions specifically. Sources: ai.google.dev/gemini-api/terms (last updated 28 Apr 2026, re-confirmed unchanged 01 Aug 2026) Confidence: vendor-documented


Practice: Don’t assume a Google AI Pro/Ultra personal subscription gets the same “no training” guarantee as a paid API key — Google’s own docs disagree with each other

Do: Google’s Gemini API FAQ says paid usage isn’t used for training, but Gemini CLI’s own official Terms-of-Service/Privacy-Notice matrix maps a Google AI Pro/Ultra personal account (used via “Login with Google” for Gemini Code Assist) to the general Google Privacy Policy, not to the Gemini API’s “Paid Services” no-training clause. A user filed this exact discrepancy with the gemini-cli maintainers, asking for the docs to clarify that paid Pro/Ultra subscribers get the same protection as paid API users; Google closed the issue “not planned” without publishing a clarifying statement. Treat “I pay for AI Pro/Ultra, so my code isn’t used for training” as unverified, not confirmed, until Google clarifies. Why (beginner): It’s a reasonable, common assumption that “I pay for it, so it’s private” — and Google’s marketing FAQs read that way — but the CLI team’s own reference table doesn’t back that up for personal Pro/Ultra subscriptions, and Google chose not to resolve the ambiguity when directly asked. If privacy is your top priority, use a billing-enabled API key or Vertex AI instead, where the “Paid Services” no-training language unambiguously applies. Caveat / contested: This is now somewhat overtaken by the June 2026 retirement of personal OAuth login in the open-source gemini-cli (see first practice) — the ambiguity still matters for the Gemini Code Assist IDE extensions / Antigravity and other Google AI products tied to the same Pro/Ultra account, just not for the gemini-cli binary itself going forward. 🕒 verify live — Antigravity is a newer, evolving product and its own ToS/privacy mapping could not be independently confirmed as of this snapshot (searched 01 Aug 2026, no primary source found addressing it specifically); this is a genuine open gap, not a guess. Sources: github.com/google-gemini/gemini-cli issue #20569 (closed, not planned) · github.com/google-gemini/gemini-cli — docs/resources/tos-privacy.md (official terms/privacy matrix, fetched 01 Aug 2026) Confidence: contested (Google’s Gemini API FAQ language vs. the gemini-cli team’s own ToS/privacy matrix and their refusal to reconcile the two)


Practice: For the strongest documented guarantee, use a paid Gemini API key or Vertex AI, and turn on Zero Data Retention if you need it

Do: These are advanced/enterprise-tier options — skip this practice if you’re on the free or personal-paid tier and don’t have a specific compliance requirement. On the paid Gemini Developer API, you can request Zero Data Retention (ZDR) approval for a specific Cloud project. Once approved, prompts/responses and identifiable metadata (IP address, Google Account ID) are stripped before any logging happens, instead of being retained in identifiable form for the standard abuse-monitoring window. On Google Cloud / Vertex AI, Google’s Gemini-for-Google-Cloud data-governance page states plainly: “Gemini doesn’t use your prompts or its responses as data to train its models,” backed by Google Cloud’s published AI/ML Privacy Commitment not to train foundation models on customer data without permission. Why (beginner): If you’re evaluating Gemini CLI for real work at a company, Vertex AI + ZDR (or a billing-enabled API key + ZDR) is the combination with the clearest paper trail — useful when you need to answer a security questionnaire, not just a blog post’s opinion. Caveat / contested: ZDR has real exceptions: it does not cover Grounding with Google Search or Maps (30-day retention), the Interactions API (must separately opt out with store: false), or the Live API (unless session resumption is left unconfigured) — and you must also avoid explicit context caching and manage file deletion yourself for a genuinely zero footprint. 🕒 verify live — ZDR is an approval-gated feature; confirm current eligibility before relying on it. Sources: ai.google.dev/gemini-api/docs/zdr (fetched 01 Aug 2026) · docs.cloud.google.com/gemini/docs/discover/data-governance (last updated 17 Jul 2026) Confidence: vendor-documented


Practice: Know exactly where Gemini CLI puts your credentials on disk, and lock the files down yourself

Do: Gemini CLI’s OAuth session is cached at ~/.gemini/oauth_creds.json; API keys are commonly persisted via ~/.gemini/.env (or a project-local .env) or shell profile exports; Vertex AI service-account and Application Default Credentials are plain JSON files (paths vary by OS, set via GOOGLE_APPLICATION_CREDENTIALS). None of these are OS-keychain-encrypted by default on Linux — they are readable JSON/text files. A previously-filed bug (issue #6170, opened 13 Aug 2025) noted that Google’s fix to set oauth_creds.json to owner-only permissions (600) on creation didn’t retroactively fix files created before the patch; that gap was itself closed by a merged fix (PR #6662, merged 29 Aug 2025) that added an explicit chmod step so existing files get corrected too. As a defense-in-depth habit regardless, you can always run chmod 600 ~/.gemini/oauth_creds.json (and any .env file with keys in it) yourself after any upgrade. Separately, a feature request to add Linux keyring (Secrets API / GNOME Keyring / KWallet) support for API keys was closed “not planned." Why (beginner): Don’t assume “logged in” means “protected like a password manager entry.” Anyone else with read access to your home directory (a shared machine, a misconfigured container, an infostealer) can potentially read these files directly. Running chmod 600 ~/.gemini/oauth_creds.json costs nothing and removes any doubt about your current file’s permissions. Caveat / contested: Independent researchers (Netwrix) surveying 14 AI coding tools found this plaintext-credential pattern is common industry-wide, not unique to Gemini CLI — but they specifically flagged Gemini’s Application Default Credentials files as unencrypted JSON across Linux, macOS, and Windows. Sources: github.com/google-gemini/gemini-cli issue #6170 (opened 13 Aug 2025, closed) · github.com/google-gemini/gemini-cli PR #6662 (merged 29 Aug 2025, verified fetched 01 Aug 2026 — adds explicit chmod for pre-existing files) · github.com/google-gemini/gemini-cli issue #10232 (closed, not planned) · netwrix.com — AI coding assistants are leaking credentials (12 May 2026) Confidence: independently-corroborated


Practice: Treat your Gemini API key as a bearer secret; know how to sign out/rotate it

Do: Google’s own docs explicitly warn: “Treat API keys … as sensitive credentials. Protect them to prevent unauthorized access and potential misuse of the service under your account,” and similarly for Vertex AI service-account key files (“provides access to your resources”). Inside gemini-cli, the interactive /auth slash command (typed while gemini is running) opens a dialog to change your authentication method. For Vertex AI ADC sessions using a user account, run gcloud auth revoke user@example.com (Google Cloud SDK) to invalidate that token both locally and on Google’s servers — but note this does not apply to service-account or external-account credentials: per Google’s own docs, those tokens “are not revocable” via this command, so a compromised service-account key must instead be disabled/deleted at its source (IAM). For an API key, rotate/delete it from Google AI Studio rather than just removing it from your shell — the key itself stays valid until revoked at the source. Why (beginner): An API key or OAuth token left in a .env file, a shell history, or a leaked screenshot works for anyone who has it, until you revoke it — deleting the local file alone does not disable the credential server-side. And “I ran gcloud auth revoke” doesn’t mean much if the credential was actually a service account, which that command can’t revoke. Caveat / contested: Also avoid exporting keys via ~/.bashrc/~/.zshrc/$PROFILE for convenience — Google’s own docs note this makes the key readable to any process spawned from that shell, which is a broader exposure surface than a .env file scoped to one directory. Sources: geminicli.com/docs/reference/commands/ (/auth command, fetched 01 Aug 2026) · google-gemini.github.io/gemini-cli/docs/get-started/authentication (fetched 01 Aug 2026) · docs.cloud.google.com/sdk/gcloud/reference/auth/revoke (Google Cloud SDK reference, fetched 01 Aug 2026 — confirms service/external-account tokens “are not revocable”) Confidence: vendor-documented


Practice: ⚠️ Don’t run Gemini CLI in auto-approve (“YOLO”) mode against untrusted repos or issues — it has led to real secret exfiltration

Do: Two separately discovered, patched vulnerabilities show what goes wrong when Gemini CLI is given broad trust: (1) Pillar Security (reported 16 Apr 2026, advisory GHSA-wpqr-6v78-jr5g published 24 Apr 2026, writeup published 5 May 2026, CVSS 4.0 10.0 per Google’s CNA / CVSS 3.1 7.8 per NIST — see the fundamentals entry for the full scoring dispute) found that a Gemini-powered GitHub issue-triage agent running in --yolo (auto-approval) mode could be hijacked by a hidden prompt-injection payload inside a public GitHub issue, leading to exfiltration of CI workflow secrets and Git tokens written to disk by actions/checkout — even after the workflow’s GITHUB_TOKEN env var was unset, because credentials already on disk weren’t protected. Patched in v0.39.1 / v0.40.0-preview.3. (2) Tracebit (discovered 27 Jun 2025, published 28 Jul 2025) found that simply asking Gemini CLI to analyze an untrusted local repository — no special flags needed — could trigger silent execution of a shell command disguised as an already-whitelisted grep, exfiltrating all of the user’s environment variables (potentially including API keys/secrets) to a remote server, with no visible warning. Patched in v0.1.14. Why (beginner): These aren’t hypothetical: both were real, working exploits against the default or auto-approve configuration, targeting exactly the credentials this entry is about (API keys, Git tokens, env vars). Never point Gemini CLI’s auto-approve/--yolo mode at a repository or issue tracker you don’t control, and keep the CLI updated — both bugs are fixed in current releases but a similar class of prompt-injection issue could recur. Caveat / contested: Both were responsibly disclosed and patched before public write-ups; there is no evidence either was exploited in the wild against real users before the fix shipped. Confirm you’re on a version at or after the patched releases above. Note these are two independently-discovered, single-sourced incidents (Pillar found the CI/CD one; Tracebit found the grep-whitelist one) — each is individually well-documented, but the two sources don’t corroborate each other’s specific finding, so treat this as two solid single-source reports rather than one doubly-corroborated claim. Sources: pillar.security — My Agentic Trust Issues (5 May 2026) · tracebit.com — Code Execution Through Deception (28 Jul 2025) Confidence: thin


Held pending fixes (not publish-ready)

CHANGELOG (grading → this entry)

  1. KILL (Skeptic): Antigravity replacement binary av and env var AV_API_KEY were fabricated — not present in either originally-cited source. Corrected to the verified binary agy and env var ANTIGRAVITY_API_KEY, sourced to a GitHub issue thread.
  2. KILL (Skeptic): GitHub issue #6170 was described as “still-open”/“unresolved”; it is actually Closed. Sensei independently re-fetched the linked fix (PR #6662, merged 29 Aug 2025) and confirmed it explicitly patches the exact gap described (pre-existing files not getting corrected permissions) — rewritten to state the issue is closed and the underlying gap is fixed, while keeping the chmod habit as a costless defense-in-depth step.
  3. FIX (Skeptic): /auth command citation pointed to a page that doesn’t document it. Sensei independently re-fetched and found /auth is real, documented at geminicli.com/docs/reference/commands/ — citation corrected.
  4. FIX (Skeptic): gcloud auth revoke claim was over-broad — the command does not revoke service-account or external-account tokens, only user-account tokens. Narrowed accordingly with the exception stated explicitly, plus a full example command with an account argument.
  5. FIX (Skeptic): The YOLO-exfiltration practice was labeled independently-corroborated despite each cited source backing a different vulnerability (not corroborating each other). Relabeled thin with an explanatory caveat; Pillar blog date corrected from the advisory date (24 Apr 2026, used inconsistently in the sibling entry) to the actual blog publish date (5 May 2026).
  6. FLAG (Skeptic): Dropped “OIDC credentials” from the Pillar exfiltration list — not supported by the re-fetched source.
  7. FLAG (Skeptic): Practice-1 heading over-generalized “no longer works”; retitled to specify free/Pro/Ultra accounts, since Workspace/enterprise OAuth still works.
  8. Beginner-panel FIX: Added the actual export GEMINI_API_KEY=... command (previously missing) so the API-key path has a working end state.
  9. Beginner-panel FIX: Vertex AI prerequisites were listed as bare nouns; rewritten as an explicit step list with a link to Google’s quickstart.
  10. Beginner-panel FIX: Added full gcloud auth revoke user@example.com syntax with an account argument (previously bare).
  11. Beginner-panel FIX: Added a one-line “these are advanced/enterprise features, skip if on free/personal-paid tier” framing to the ZDR practice, ahead of the dense Live API/Interactions API/context-caching jargon.