Unable to upgrade Flutter: no origin repository co

2020-08-12 17:54发布

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?

标签: flutter
4条回答
贪生不怕死
2楼-- · 2020-08-12 18:35

I was trying to install flutter on my new ubuntu pc, following the directions on the official website: https://flutter.dev/docs/get-started/install/linux

I went with their initial steps of downloading the flutter sdk directly on my device, rather than cloning a git repo. Due to this my IDE kept popping a notification that the flutter version wasn't compatible.

I just had to delete the installed sdk files, and clone the git repo. This made it work like a charm.

查看更多
女痞
3楼-- · 2020-08-12 18:42

Fixed it on Windows, I think this is a git issue:

  • ensure PATH contains latest Git (mine is 2.25.1, updated from 1.18) and flutter\bin.
  • > git clone https://github.com/flutter/flutter.git
  • > flutter channel master
  • > flutter doctor --android-licenses
  • > flutter doctor -v
  • > flutter upgrade
查看更多
【Aperson】
4楼-- · 2020-08-12 18:53

I fixed this issue.I ran flutter channel stable,

I got the below output...

E:\flutter_Apps\flutter_app_dont_stare_v2>flutter channel stable
Warning! The 'flutter' tool you are currently running is from a different Flutter repository than the one last used by this package. The repository from which the 'flutter' tool is
currently executing will be used instead.
  running Flutter tool: C:\src\flutter
  previous reference  : C:\flutter\flutter\flutter
This can happen when you have multiple copies of flutter installed. Please check your system path to verify that you are running the expected version (run 'flutter --version' to see
which flutter is on your path).

Switching to flutter channel 'stable'...
git: From https://github.com/flutter/flutter
git:  * [new branch]          Hixie-patch-1          -> origin/Hixie-patch-1
git:  + d3ed9ec94...f994b7697 beta                   -> origin/beta  (forced update)
git:  * [new branch]          dds_integration_take_2 -> origin/dds_integration_take_2
git:    7f56b53de..d9653445f  dev                    -> origin/dev
git:    d3ed9ec94..b041144f8  flutter-1.17-candidate.3 -> origin/flutter-1.17-candidate.3
git:  * [new branch]          flutter-1.18-candidate.10 -> origin/flutter-1.18-candidate.10
git:  * [new branch]          flutter-1.18-candidate.11 -> origin/flutter-1.18-candidate.11
git:  * [new branch]          flutter-1.18-candidate.12 -> origin/flutter-1.18-candidate.12
git:  * [new branch]          flutter-1.18-candidate.13 -> origin/flutter-1.18-candidate.13
git:  * [new branch]          flutter-1.18-candidate.6 -> origin/flutter-1.18-candidate.6
git:  * [new branch]          flutter-1.18-candidate.7 -> origin/flutter-1.18-candidate.7
git:  * [new branch]          flutter-1.18-candidate.8 -> origin/flutter-1.18-candidate.8
git:  * [new branch]          flutter-1.18-candidate.9 -> origin/flutter-1.18-candidate.9
git:  * [new branch]          flutter-1.19-candidate.0 -> origin/flutter-1.19-candidate.0
git:  * [new branch]          flutter-1.19-candidate.1 -> origin/flutter-1.19-candidate.1
git:  * [new branch]          flutter-1.19-candidate.2 -> origin/flutter-1.19-candidate.2
git:  * [new branch]          flutter-1.19-candidate.3 -> origin/flutter-1.19-candidate.3
git:  * [new branch]          flutter-1.19-candidate.4 -> origin/flutter-1.19-candidate.4
git:  * [new branch]          flutter-1.19-candidate.5 -> origin/flutter-1.19-candidate.5
git:  * [new branch]          flutter-1.20-candidate.0 -> origin/flutter-1.20-candidate.0
git:    9cc69d47a..401690a64  master                 -> origin/master
git:  * [new branch]          revert-51465-fab-complete-new -> origin/revert-51465-fab-complete-new
git:  * [new branch]          roll_branch            -> origin/roll_branch
git:  + f139b1100...b041144f8 stable                 -> origin/stable  (forced update)
git:  * [new tag]             1.17.3                 -> 1.17.3
git:  * [new tag]             1.18.0-10.0.pre        -> 1.18.0-10.0.pre
git:  * [new tag]             1.18.0-11.0.pre        -> 1.18.0-11.0.pre
git:  * [new tag]             1.18.0-11.1.pre        -> 1.18.0-11.1.pre
git:  * [new tag]             1.18.0-13.0.pre        -> 1.18.0-13.0.pre
git:  * [new tag]             1.18.0-7.0.pre         -> 1.18.0-7.0.pre
git:  * [new tag]             1.18.0-8.0.pre         -> 1.18.0-8.0.pre
git:  * [new tag]             1.18.0-9.0.pre         -> 1.18.0-9.0.pre
git:  * [new tag]             1.19.0-0.0.pre         -> 1.19.0-0.0.pre
git:  * [new tag]             1.19.0-1.0.pre         -> 1.19.0-1.0.pre
git:  * [new tag]             1.19.0-2.0.pre         -> 1.19.0-2.0.pre
git:  * [new tag]             1.19.0-3.0.pre         -> 1.19.0-3.0.pre
git:  * [new tag]             1.19.0-4.1.pre         -> 1.19.0-4.1.pre
git:  * [new tag]             1.19.0-5.0.pre         -> 1.19.0-5.0.pre
git:  * [new tag]             1.20.0-0.0.pre         -> 1.20.0-0.0.pre
git:  * [new tag]             1.17.0                 -> 1.17.0
git:  * [new tag]             1.17.0-3.2.pre         -> 1.17.0-3.2.pre
git:  * [new tag]             1.17.0-3.3.pre         -> 1.17.0-3.3.pre
git:  * [new tag]             1.17.0-3.4.pre         -> 1.17.0-3.4.pre
git:  * [new tag]             1.17.1                 -> 1.17.1
git:  * [new tag]             1.17.2                 -> 1.17.2
git:  * [new tag]             1.18.0-12.0.pre        -> 1.18.0-12.0.pre
git:  * [new tag]             1.18.0-6.0.pre         -> 1.18.0-6.0.pre
git:  * [new tag]             1.19.0-4.0.pre         -> 1.19.0-4.0.pre
git: Your branch and 'origin/stable' have diverged,
git: and have 12 and 1517 different commits each, respectively.
git:   (use "git pull" to merge the remote branch into yours)
git: Previous HEAD position was 0b8abb472 Do not use logcat -T on pre-lollipop Android
git: Switched to branch 'stable'

and then flutter upgrade --force before getting this

E:\flutter_Apps\flutter_app_dont_stare_v2>flutter upgrade --force
Checking Dart SDK version...
Downloading Dart SDK from Flutter engine af51afceb8886cc11e25047523c4e0c7e1f5d408...
Unzipping Dart SDK...
Building flutter tool...
Running pub upgrade...
Warning! The 'flutter' tool you are currently running is from a different Flutter repository than the one last used by this package. The repository from which the 'flutter' tool is
currently executing will be used instead.
  running Flutter tool: C:\src\flutter
  previous reference  : C:\flutter\flutter\flutter
This can happen when you have multiple copies of flutter installed. Please check your system path to verify that you are running the expected version (run 'flutter --version' to see
which flutter is on your path).

Upgrading Flutter from C:\src\flutter...
Updating files:  23% (891/3793)
Updating files:  24% (911/3793)
Updating files:  25% (949/3793)
Updating files:  26% (987/3793)
Updating files:  27% (1025/3793)
Updating files:  28% (1063/3793)
Updating files:  29% (1100/3793)
Updating files:  30% (1138/3793)
Updating files:  31% (1176/3793)
Updating files:  32% (1214/3793)
Updating files:  33% (1252/3793)
Updating files:  34% (1290/3793)
Updating files:  35% (1328/3793)
Updating files:  36% (1366/3793)
Updating files:  37% (1404/3793)
Updating files:  38% (1442/3793)
Updating files:  39% (1480/3793)
Updating files:  40% (1518/3793)
Updating files:  41% (1556/3793)
Updating files:  41% (1574/3793)
Updating files:  42% (1594/3793)
Updating files:  43% (1631/3793)
Updating files:  44% (1669/3793)
Updating files:  45% (1707/3793)
Updating files:  46% (1745/3793)
Updating files:  47% (1783/3793)
Updating files:  48% (1821/3793)
Updating files:  49% (1859/3793)
Updating files:  50% (1897/3793)
Updating files:  50% (1904/3793)
Updating files:  51% (1935/3793)
Updating files:  52% (1973/3793)
Updating files:  53% (2011/3793)
Updating files:  54% (2049/3793)
Updating files:  55% (2087/3793)
Updating files:  56% (2125/3793)
Updating files:  57% (2163/3793)
Updating files:  58% (2200/3793)
Updating files:  58% (2225/3793)
Updating files:  59% (2238/3793)
Updating files:  60% (2276/3793)
Updating files:  61% (2314/3793)
Updating files:  62% (2352/3793)
Updating files:  62% (2382/3793)
Updating files:  63% (2390/3793)
Updating files:  64% (2428/3793)
Updating files:  65% (2466/3793)
Updating files:  65% (2503/3793)
Updating files:  66% (2504/3793)
Updating files:  67% (2542/3793)
Updating files:  67% (2566/3793)
Updating files:  68% (2580/3793)
Updating files:  69% (2618/3793)
Updating files:  70% (2656/3793)
Updating files:  71% (2694/3793)
Updating files:  72% (2731/3793)
Updating files:  73% (2769/3793)
Updating files:  74% (2807/3793)
Updating files:  74% (2815/3793)
Updating files:  75% (2845/3793)
Updating files:  76% (2883/3793)
Updating files:  77% (2921/3793)
Updating files:  78% (2959/3793)
Updating files:  79% (2997/3793)
Updating files:  79% (3022/3793)
Updating files:  80% (3035/3793)
Updating files:  81% (3073/3793)
Updating files:  82% (3111/3793)
Updating files:  83% (3149/3793)
Updating files:  83% (3161/3793)
Updating files:  84% (3187/3793)
Updating files:  85% (3225/3793)
Updating files:  86% (3262/3793)
Updating files:  87% (3300/3793)
Updating files:  87% (3310/3793)
Updating files:  88% (3338/3793)
Updating files:  89% (3376/3793)
Updating files:  90% (3414/3793)
Updating files:  90% (3439/3793)
Updating files:  91% (3452/3793)
Updating files:  92% (3490/3793)
Updating files:  93% (3528/3793)
Updating files:  93% (3546/3793)
Updating files:  94% (3566/3793)
Updating files:  95% (3604/3793)
Updating files:  96% (3642/3793)
Updating files:  96% (3650/3793)
Updating files:  97% (3680/3793)
Updating files:  97% (3706/3793)
Updating files:  98% (3718/3793)
Updating files:  99% (3756/3793)
Updating files:  99% (3760/3793)
Updating files: 100% (3793/3793)
Updating files: 100% (3793/3793), done.
Updating cf37c2cd0..b041144f8
 dev/benchmarks/macrobenchmarks/assets/999x1000.png |   Bin 0 -> 3561 bytes
 .../benchmarks/macrobenchmarks}/macos/.gitignore   |     0
 .../xcshareddata/IDEWorkspaceChecks.plist          |     0
 .../Runner.xcworkspace}/contents.xcworkspacedata   |     0
 .../xcshareddata/IDEWorkspaceChecks.plist          |     0
 .../macos/Runner/Base.lproj/MainMenu.xib           |     0
 .../macos/Runner/Configs/Debug.xcconfig            |     0
 .../macos/Runner/Configs/Release.xcconfig          |     0
 .../macos/Runner/Configs/Warnings.xcconfig         |     0
 .../macos/Runner/DebugProfile.entitlements         |     0
 .../macrobenchmarks}/macos/Runner/Info.plist       |     0
 .../macos/Runner/Release.entitlements              |     0
 .../android/gradle.properties                      |     0
 .../gradle/wrapper/gradle-wrapper.properties       |     0
 .../ios/Flutter/AppFrameworkInfo.plist             |     0
 .../ios/Flutter/Flutter.xcconfig                   |     0
 .../xcshareddata/IDEWorkspaceChecks.plist          |     0
 .../AppIcon.appiconset/Icon-App-76x76@3x.png       |   Bin 0 -> 4867 bytes
 .../ios/Runner/Base.lproj/LaunchScreen.storyboard  |     0
 .../ios/Runner/Base.lproj/Main.storyboard          |     0
 .../app/src/main/res/mipmap-hdpi/ic_launcher.png   |   Bin
 .../app/src/main/res/mipmap-mdpi/ic_launcher.png   |   Bin
 .../app/src/main/res/mipmap-xhdpi/ic_launcher.png  |   Bin
 .../app/src/main/res/mipmap-xxhdpi/ic_launcher.png |   Bin
 .../src/main/res/mipmap-xxxhdpi/ic_launcher.png    |   Bin
 .../test_apps}/stocks/android/gradle.properties    |     0
 .../gradle/wrapper/gradle-wrapper.properties       |     0
 .../test_apps}/stocks/fuchsia/meta/stocks.cmx      |     0
 .../stocks/ios/Flutter/AppFrameworkInfo.plist      |     0
 .../test_apps/stocks/ios/Flutter/Debug.xcconfig    |     0
 .../project.xcworkspace}/contents.xcworkspacedata  |     0
 .../xcshareddata/IDEWorkspaceChecks.plist          |     0
 .../xcshareddata/xcschemes/Runner.xcscheme         |     0
 .../Runner.xcworkspace}/contents.xcworkspacedata   |     0
 .../AppIcon.appiconset/Contents.json               |     0
 .../AppIcon.appiconset/Icon-60@2x.png              |   Bin
 .../AppIcon.appiconset/Icon-60@3x.png              |   Bin
 .../Assets.xcassets/AppIcon.appiconset/Icon-76.png |   Bin
 .../AppIcon.appiconset/Icon-76@2x.png              |   Bin
 .../AppIcon.appiconset/Icon-83.5@2x.png            |   Bin
 .../AppIcon.appiconset/Icon-Notification.png       |   Bin
 .../AppIcon.appiconset/Icon-Notification@2x.png    |   Bin
 .../AppIcon.appiconset/Icon-Notification@3x.png    |   Bin
 .../AppIcon.appiconset/Icon-Small-40.png           |   Bin
 .../AppIcon.appiconset/Icon-Small-40@2x.png        |   Bin
 .../AppIcon.appiconset/Icon-Small-40@3x.png        |   Bin
 .../AppIcon.appiconset/Icon-Small.png              |   Bin
 .../AppIcon.appiconset/Icon-Small@2x.png           |   Bin
 .../AppIcon.appiconset/Icon-Small@3x.png           |   Bin
 .../ios/Runner/Base.lproj/LaunchScreen.storyboard  |     0
 .../stocks/ios/Runner/Base.lproj/Main.storyboard   |     0
 .../test_apps}/stocks/ios/Runner/Info.plist        |     0
 .../test_apps/stocks/lib/i18n/stocks_en.arb        |     0
 .../test_apps/stocks/lib/i18n/stocks_es.arb        |     0
 dev/devicelab/images/agent-statuses.png            |   Bin 13842 -> 0 bytes
 dev/devicelab/images/broken-test.png               |   Bin 56878 -> 0 bytes
 dev/devicelab/images/legend.png                    |   Bin 30220 -> 0 bytes
 .../app/src/main/res/mipmap-hdpi/ic_launcher.png   |   Bin 0 -> 544 bytes
 .../app/src/main/res/mipmap-mdpi/ic_launcher.png   |   Bin
 .../app/src/main/res/mipmap-xhdpi/ic_launcher.png  |   Bin 0 -> 721 bytes
 .../app/src/main/res/mipmap-xxhdpi/ic_launcher.png |   Bin 0 -> 1031 bytes
 .../src/main/res/mipmap-xxxhdpi/ic_launcher.png    |   Bin 0 -> 1443 bytes
 .../assets/red_square.png                          |   Bin 0 -> 629 bytes
 .../project.xcworkspace}/contents.xcworkspacedata  |     0
 .../xcshareddata/xcschemes/Runner.xcscheme         |     0
 .../Runner.xcworkspace/contents.xcworkspacedata    |     0
 .../AppIcon.appiconset/Icon-App-1024x1024@1x.png   |   Bin 0 -> 10932 bytes
 .../AppIcon.appiconset/Icon-App-20x20@1x.png       |   Bin 0 -> 564 bytes
 .../AppIcon.appiconset/Icon-App-20x20@2x.png       |   Bin 0 -> 1283 bytes
 .../AppIcon.appiconset/Icon-App-20x20@3x.png       |   Bin 0 -> 1588 bytes




    and so on
查看更多
Summer. ? 凉城
5楼-- · 2020-08-12 18:57

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.

查看更多
登录 后发表回答