无法为 web 设置颤振

时间:2021-05-07 07:02:04

标签: flutter flutter-web

当我尝试执行命令时:flutter channel beta 我收到以下错误:

Switching to flutter channel 'beta'...
git: fatal: unable to access 'https://github.com/flutter/flutter.git/': error setting certificate verify 
locations:  CAfile: C:\Program Files\Git\mingw64\ssl\certs\ca-bundle.cert CApath: none
Switching channels failed with error code 128.

其中一个 SO 解决方案建议我使用命令:git config --system http.sslcainfo 'C:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt',但这并没有改变错误。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

我发现问题不在于颤振,而在于 git。 Flutter 使用 git 作为其命令,而 git 无法找到证书文件。对我有用的是:

  1. 访问https://github.com/flutter/flutter.git/
  2. 从地址栏中查看证书并保存(比如 poc.cer)
  3. 使用以下命令将此证书添加到 git config:git config --global http.sslCAInfo "C:\Users\Username\Desktop\poc.cer"

现在命令可以正常工作了