Unable to setup flutter for web

Issue

When I try to execute command: flutter channel beta I get the below error:

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.

One of the SO solutions suggested I use the command: git config --system http.sslcainfo 'C:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt', but this did not change the error. How do I fix this?

Solution

I figured out that the issue was not with flutter, but with git. Flutter uses git for its commands and git was not able to locate the certificate file. What worked for me was:

  1. Visit https://github.com/flutter/flutter.git/
  2. View the certificate from the address bar and save it ( lets say as poc.cer )
  3. Add this certificate to git config using : git config –global http.sslCAInfo "C:\Users\Username\Desktop\poc.cer"

Now the commands work without any issue

Answered By – codingsplash

Answer Checked By – Timothy Miller (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.