Installing Gemini CLI and writing GEMINI.md: getting started with a free Google account

Gemini CLI Published: Updated:

Install Google's Gemini CLI, sign in with a Google account or API key, run your first task, and learn where GEMINI.md lives, how it is loaded, and how to check it with /memory.

Verified on Sep 11, 2026 These tools change quickly. Please also check the latest official documentation.
Contents
  1. Requirements
  2. Installation
  3. Signing in
  4. First task
  5. GEMINI.md: role and locations
  6. A GEMINI.md template
  7. Saving notes during a session
  8. Summary

Gemini CLI is Google's open-source coding agent for the terminal. Its standout feature is that a personal Google account is enough to start using it for free, within rate limits.

This article walks through installation, sign-in and the first task, then explains GEMINI.md, the file that tells Gemini CLI about your project.

KEY POINT

What you will learn

  • Installation and sign-in with a Google account or API key
  • Where GEMINI.md lives, how it is loaded, and how to inspect it
  • A GEMINI.md template you can adapt

Requirements

ItemDetail
Node.js20 or later
OSmacOS, Linux, Windows
AccountPersonal Google account (free tier), a Gemini API key, or Google Cloud (Vertex AI)

Installation

# global install with npm
npm install -g @google/gemini-cli

# or Homebrew on macOS
brew install gemini-cli

# or try it without installing
npx @google/gemini-cli
gemini --version

Signing in

Run gemini in your project directory. The first start asks how you want to authenticate.

cd path/to/project
gemini
MethodNotes
Google accountBrowser sign-in. A personal account gets the free tier
Gemini API keyIssued in Google AI Studio; set GEMINI_API_KEY
Vertex AIThrough a Google Cloud project; for organizations
# using an API key
export GEMINI_API_KEY="your-key"

First task

Explain the structure of this repository and how to run the tests

Gemini CLI reads files and runs commands as needed, asking before it changes files or executes commands. Choosing "always allow" skips the prompt for that kind of action for the rest of the session.

Useful commands during a session:

CommandWhat it does
/helpList commands
/memory showShow the loaded GEMINI.md content
/memory refreshReload GEMINI.md
/toolsList available tools
/mcpMCP server status
/statsToken usage
/clearClear the screen and history

GEMINI.md: role and locations

Gemini CLI looks for GEMINI.md at start-up and treats it as project context, the same role CLAUDE.md plays for Claude Code and AGENTS.md for Codex.

LocationPurpose
~/.gemini/GEMINI.mdPersonal preferences for all projects
GEMINI.md at the repository rootShared project rules
GEMINI.md in a subdirectoryExtra rules loaded when working in that directory

The files are concatenated; /memory show displays the result.

用語解説

context.fileName: Set fileName inside the context object in settings.json to make Gemini CLI read a different file name, such as AGENTS.md. Useful when you want to share one context file with Codex.

A GEMINI.md template

# Project overview
Django + React internal tool. Backend in `backend/`, frontend in `frontend/`.

## Commands
- Backend tests: `cd backend && pytest`
- Frontend tests: `cd frontend && npm test`
- Lint: `cd backend && ruff check .` / `cd frontend && npm run lint`
- Dev server: `docker compose up`

## Conventions
- Python: type hints required; no `Any`
- React: function components only; use the existing Zustand store for state
- API schemas live in `backend/api/schemas/`; regenerate frontend types with the generator

## Do not modify
- Existing files under `backend/migrations/`
- `frontend/src/generated/`

## Workflow
- Read related tests before changing code
- Present a plan before changes spanning several files
- Include the commands you ran and their results in the completion report

/init generates a first draft from the project. Trim anything the README already says and keep only the agreements you cannot see in the code, the same approach as in How to write CLAUDE.md.

Saving notes during a session

/memory add <text> appends the text to your user-level GEMINI.md. Anything you keep repeating is worth saving this way so it carries over to the next session.

Summary

  • Install with npm install -g @google/gemini-cli, run gemini, sign in with a Google account
  • GEMINI.md is merged from ~/.gemini/, the repository root and subdirectories
  • Check what is loaded with /memory show; reload with /memory refresh
  • Generate a draft with /init, then keep it to commands, conventions, no-go areas and workflow

FAQ

Is Gemini CLI really free?
Signing in with a personal Google account gives you a free tier with per-minute and per-day request limits. For heavier or commercial use, switch to an API key or Vertex AI.
Where does GEMINI.md go?
Global preferences in ~/.gemini/GEMINI.md, shared project rules at the repository root, and directory-specific rules in that directory.
How do I see which GEMINI.md files are loaded?
Run /memory show during a session. After editing, /memory refresh reloads them.

Primary sources

This article was drafted by AI from official documentation and reviewed by the site operator before publishing. Found a mistake? Let us know via the contact page.