Google gemini cli&code assist安装tips

Google gemini cli可以使用google帐号,免费使用google gemini,不过安装的过程中需要注意科学上网的问题。

Gemini cli


Gemini cli安装比较简单,参考https://zhuanlan.zhihu.com/p/1921330328833857501

npm install -g @google/gemini-cli
export https_proxy=http://127.0.0.1:7890
gemini

记得运行gemini之前要设置代理

进入之后记得auth选择Login with Google,不要选API(免费API没有quota)

Gemini code assist

vs code中安装Gemini code assist

然后在settings.json中添加以下部分:

{
    "http.proxyStrictSSL": false, // 如果代理是自签名的,或者遇到SSL/TLS问题时可以设置为false
    "http.proxy": "http://127.0.0.1:7890", // 你的代理服务器地址和端口
    "http.proxySupport": "override", // 确保此设置覆盖系统代理

    "http.noProxy": [
        "localhost",
        "127.0.0.1",
        "192.168.0.0/16",
        "172.0.0.0/8",
        "*.cn", 
        "*nsfocus*"
    ],
    "http.systemCertificates": false,
}

点击登陆,界面跟gemini cli是一样的。

注意,这里一定要加代理,否则会出现浏览器在Google的登陆界面卡死,其实是跳转到本地的http://localhost:64829/oauth2redirect?state=a89bf434-0823-4fe3-aae6-57cfe0c4bcd1&code=4/0AVMBsJiU-SrjmFikjjJoF_o2-oKgMihWtmkeybUh7AljU7IsP2c3dJotEdPFVG-cOqXmVA&scope=email%20profile%20https://www.googleapis.com/auth/cloud-platform%20https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/userinfo.profile%20openid&authuser=0&prompt=consent 页面,此时vs code收到请求后连接google服务器,连不上就卡住了……

Leave a Reply

Your email address will not be published. Required fields are marked *