I tried to update flutter from this command using cmd:
flutter upgrade And I got:
Unable to upgrade Flutter: no origin repository configured. Run 'git remote add origin https://github.com/flutter/flutter' in C:\flutter What is the reason and how I can solve this?
Try flutter doctor, you will see flutter channel unknown. That is the reason, Flutter uses git to manage the Framework and when you checkout to different commit code / tags flutter channel changed to unknown.
Here is what you have to do:
flutter channel stable Above I mentioned stable, if you need change the channel that you want to checkout (see available channels by flutter channel in terminal / cmd).
Then:
flutter upgrade Everything should work now.
If not try below:
Go to flutter framework located directory and set upstream by git branch --set-upstream-to=origin/stable stable.
Please note that flutter channel stable is equivalent to git checkout stable if you try in flutter framework located directory.
Learn lot more info about this issue from already reported issue tracker.
First check the flutter doctor response
when you get channel unknown, follow these steps
In Flutter framework located directory, set upstream by
git branch --set-upstream-to=origin/stable stable.
Then, flutter upgrade
It will fix the error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With