I am trying to upgrade my flutter. When I hit flutter upgrade in the terminal in the android studio I receive the error 'Unable to upgrade Flutter: no origin repository configured. Run 'git remote add origin https://github.com/flutter/flutter''.
When I try to see flutter channels, I type flutter channel in the terminal in android studio, but I can't see any channels. The list is empty. Check the screenshot
After running the flutter channel stable in the terminal, it switched successfully. I ran the flutter upgrade command again and the same issue happened again. The screenshot is attached. New screenshot
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.
Originally answered here.