gemini-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGemini CLI
Gemini CLI
Query and edit large codebases, generate apps from images or PDFs, and automate complex workflows - all from your terminal with Gemini AI.
通过终端借助Gemini AI查询和编辑大型代码库、从图片或PDF生成应用、自动化复杂工作流。
Quick Start
快速开始
bash
undefinedbash
undefinedInstall globally
全局安装
npm install -g @google/gemini-cli
npm install -g @google/gemini-cli
Run (starts interactive session)
运行(启动交互式会话)
gemini
gemini
Or run without install
或无需安装直接运行
npx @google/gemini-cli
undefinednpx @google/gemini-cli
undefinedAuthentication
身份验证
On first run, select authentication method:
- Login with Google - Most common, uses existing Google account
- API Key - For programmatic access via environment variable
GEMINI_API_KEY - Vertex AI - Enterprise, requires Google Cloud project
首次运行时,选择身份验证方式:
- 使用Google账号登录 - 最常用方式,使用现有Google账号
- API密钥 - 通过环境变量实现程序化访问
GEMINI_API_KEY - Vertex AI - 企业级方案,需要Google Cloud项目
Key Commands
核心命令
| Command | Description |
|---|---|
| Show available commands |
| Open settings editor |
| Select Gemini model (Auto, Pro, Flash) |
| Save conversation state |
| Resume saved conversation |
| Revert file changes to checkpoint |
| Display loaded GEMINI.md content |
| List available agent skills |
| List MCP servers and tools |
| Display available tools |
| Execute shell command |
| Include file/directory in prompt |
| 命令 | 描述 |
|---|---|
| 显示可用命令 |
| 打开设置编辑器 |
| 选择Gemini模型(Auto、Pro、Flash) |
| 保存对话状态 |
| 恢复已保存的对话 |
| 将文件更改恢复到检查点状态 |
| 显示已加载的GEMINI.md内容 |
| 列出可用的Agent技能 |
| 列出MCP服务器和工具 |
| 显示可用工具 |
| 执行Shell命令 |
| 在提示中包含文件/目录 |
Configuration
配置
Configuration files location: (global) or (project)
~/.gemini/.gemini/Key files:
- - CLI settings
settings.json - - Project context/instructions (hierarchical memory)
GEMINI.md - - Agent skills directory
skills/
配置文件位置:(全局)或 (项目级)
~/.gemini/.gemini/关键文件:
- - CLI设置文件
settings.json - - 项目上下文/说明文件(分层记忆)
GEMINI.md - - Agent技能目录
skills/
Documentation
文档
Full documentation in . Consult for detailed navigation.
docs/docs/000-index.md完整文档位于目录。请查阅获取详细导航指引。
docs/docs/000-index.mdBy Topic
按主题分类
| Topic | Files | Description |
|---|---|---|
| Installation & Setup | 003-009 | Get Gemini CLI installed and configured |
| Basic Usage | 010-016 | Core commands, settings, and interface |
| Advanced Features | 017-032 | Security, automation, and customization |
| Architecture | 033-037 | Internal design and APIs |
| Tools | 038-045 | Built-in capabilities for files, shell, web, memory |
| Extensions | 046-048 | Creating and managing extensions |
| Hooks | 049-052 | Event-driven automation |
| IDE Integration | 053-054 | Editor integration and plugins |
| Development | 055-058 | Contributing and testing |
| Releases | 059-063 | Version history and updates |
| Reference | 064-067 | FAQ, troubleshooting, pricing, legal |
| 主题 | 文件 | 描述 |
|---|---|---|
| 安装与设置 | 003-009 | 完成Gemini CLI的安装和配置 |
| 基础使用 | 010-016 | 核心命令、设置和界面操作 |
| 高级功能 | 017-032 | 安全、自动化和自定义配置 |
| 架构 | 033-037 | 内部设计与API |
| 工具 | 038-045 | 内置的文件、Shell、网页、记忆相关功能 |
| 扩展 | 046-048 | 扩展的创建与管理 |
| 钩子 | 049-052 | 事件驱动的自动化 |
| IDE集成 | 053-054 | 编辑器集成与插件 |
| 开发 | 055-058 | 贡献与测试 |
| 版本发布 | 059-063 | 版本历史与更新 |
| 参考 | 064-067 | FAQ、故障排查、定价、法律相关 |
By Keyword
按关键词分类
| Keyword | File |
|---|---|
| installation | |
| authentication | |
| configuration | |
| commands | |
| settings | |
| model-selection | |
| themes | |
| keyboard-shortcuts | |
| session-management | |
| checkpointing | |
| sandboxing | |
| headless-mode | |
| custom-commands | |
| agent-skills | |
| enterprise | |
| trusted-folders | |
| system-prompt | |
| token-caching | |
| telemetry | |
| mcp-server | |
| gemini-md | |
| architecture | |
| policy-engine | |
| tools-api | |
| file-system-tools | |
| shell-command | |
| web-search | |
| web-fetch | |
| memory-tool | |
| todo-tool | |
| mcp-servers | |
| extensions | |
| hooks | |
| ide-integration | |
| faq | |
| troubleshooting | |
| pricing | |
| 关键词 | 文件 |
|---|---|
| installation | |
| authentication | |
| configuration | |
| commands | |
| settings | |
| model-selection | |
| themes | |
| keyboard-shortcuts | |
| session-management | |
| checkpointing | |
| sandboxing | |
| headless-mode | |
| custom-commands | |
| agent-skills | |
| enterprise | |
| trusted-folders | |
| system-prompt | |
| token-caching | |
| telemetry | |
| mcp-server | |
| gemini-md | |
| architecture | |
| policy-engine | |
| tools-api | |
| file-system-tools | |
| shell-command | |
| web-search | |
| web-fetch | |
| memory-tool | |
| todo-tool | |
| mcp-servers | |
| extensions | |
| hooks | |
| ide-integration | |
| faq | |
| troubleshooting | |
| pricing | |
Learning Path
学习路径
- Foundation: Install (004), authenticate (005), configure (006)
- Core Usage: Commands (011), settings (012), model selection (013)
- Productivity: Checkpointing (017), custom commands (020), skills (021)
- Advanced: Extensions (046-048), hooks (049-052), MCP servers (045)
- 基础阶段:安装(004)、身份验证(005)、配置(006)
- 核心使用:命令(011)、设置(012)、模型选择(013)
- 效率提升:检查点(017)、自定义命令(020)、技能(021)
- 高级进阶:扩展(046-048)、钩子(049-052)、MCP服务器(045)
Common Tasks
常见任务
Configure GEMINI.md for project context
为项目上下文配置GEMINI.md
-> (hierarchical memory setup)
docs/006-docs-get-started-configuration.md-> (分层记忆设置)
docs/006-docs-get-started-configuration.mdCreate custom slash commands
创建自定义斜杠命令
-> (TOML-based command definitions)
docs/020-docs-cli-custom-commands.md-> (基于TOML的命令定义)
docs/020-docs-cli-custom-commands.mdSet up agent skills
设置Agent技能
-> (create SKILL.md with frontmatter)
docs/021-docs-cli-skills.md-> (创建带前置元数据的SKILL.md)
docs/021-docs-cli-skills.mdRun in headless/CI mode
以无头/CI模式运行
-> (automation and JSON output)
docs/019-docs-cli-headless.md-> (自动化与JSON输出)
docs/019-docs-cli-headless.mdConfigure MCP servers
配置MCP服务器
-> (Model Context Protocol integration)
docs/045-docs-tools-mcp-server.md-> (模型上下文协议集成)
docs/045-docs-tools-mcp-server.mdBuild CLI extensions
构建CLI扩展
-> (extension development)
docs/047-docs-extensions-getting-started-extensions.md-> (扩展开发)
docs/047-docs-extensions-getting-started-extensions.mdWrite automation hooks
编写自动化钩子
-> (event-driven scripts)
docs/050-docs-hooks-writing-hooks.md-> (事件驱动脚本)
docs/050-docs-hooks-writing-hooks.mdSandbox execution for security
沙箱执行保障安全
-> (Docker/Podman isolation)
docs/018-docs-cli-sandbox.md-> (Docker/Podman隔离)
docs/018-docs-cli-sandbox.mdTroubleshoot common issues
排查常见问题
-> (debugging and error resolution)
docs/065-docs-troubleshooting.md-> (调试与错误解决)
docs/065-docs-troubleshooting.mdUnderstand pricing and quotas
了解定价与配额
-> (free tier, paid options)
docs/066-docs-quota-and-pricing.md-> (免费层级、付费选项)
docs/066-docs-quota-and-pricing.md