geminicli使用教程
摘要:记录Gemini CLI的使用教程。
Gemini CLI安装
注意gemini cli最好以管理员的身份运行,不然会有各种奇奇怪怪的问题。
# 自行安装nodejs,不能用太老的版本,不如
E:\geminicli_use>node --version
v24.12.0
# 全局安装gemini cli
E:\geminicli_use>npm install -g @google/gemini-cli因为国内访问不了谷歌,需要配置gemini cli使用的代理。在 C:\Users\你的用户名\.gemini\.env 这个文件内添加下列内容:
http_proxy=http://127.0.0.1:10809
https_proxy=http://127.0.0.1:10809
all_proxy=socks5://127.0.0.1:10808
GEMINI_API_KEY="你的apikey"配置mcp
配置chrome-devtools
(1)安装chrome-devtools
E:\geminicli_use> gemini mcp add chrome-devtools npx chrome-devtools-mcp@latest然后在 E:\geminicli_use\.gemini\settings.json 这个文件下添加如下内容:
{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": [
"chrome-devtools-mcp@latest",
"--browser-url=http://127.0.0.1:9222"
]
}
}
}(2)启动一个新的chrome浏览器实例。
# 启动chrome
"C:\Users\你的用户名\AppData\Local\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir="%TEMP%\chrome-profile-stable"完成上面两个步骤后,在gemini cli中使用show mcp
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。