【发布时间】:2021-08-02 13:15:14
【问题描述】:
我是 Flutter/Dart/Git 的新手,几周以来我一直被困在一个地方。我已经在其他几台机器上使用 Flutter/Android Studio 做了一些简单的项目,这个问题不存在。它工作正常。我想在我的主计算机上使用这个软件而不使用远程桌面...我的操作系统是 Windows 10。
每次我点击任何颤振命令时都会收到相同的错误:
fatal: not a git repository (or any of the parent directories): .git
Building flutter tool...
Running pub upgrade...
以下解决方案对我不起作用:
- 删除 ./pub-cache 文件夹,修复 pub 缓存
- git 初始化/git 克隆
- 扑干净
- flutter create --sample=material.AppBar.1 mysample
- 从其他计算机复制工作项目
- 从项目目录运行命令,例如。 C:\Users\User\AndroidStudioProjects\MyProject\
- 重新安装我使用的所有东西:Flutter、Android Studio、Git
- 禁用防病毒/从隔离区中删除颤振文件
- 可能还有其他一些
2021 年 5 月 18 日编辑
我发现在我的主机上一切正常,但在登录其他 Windows 用户帐户后。所以我的用户设置可能有问题。 我试图删除我的用户目录 C:\Users\User 中与 dart/flutter/android 相关的所有内容。之后我删除了 F:\src 目录,再次卸载了 git,克隆了颤振。不幸的是,错误仍然发生...我不知道我还能做什么... 它看起来只是配置文件中的一个简单更改,但是哪个?
Git 命令看起来可以正常工作,例如
C:\>git --version
git version 2.30.1.windows.1
Git 状态
F:\src\flutter>git status
On branch stable
Your branch is up to date with 'origin/stable'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
.knownPackages
.pub-cache_old/
.temp/
build-tools/
emulator/
licenses/
patcher/
platform-tools/
platforms/
sdk/
skins/
sources/
system-images/
tools/
nothing added to commit but untracked files present (use "git add" to track)
一切都是最新的,例如颤抖:
C:\>flutter upgrade --force
fatal: not a git repository (or any of the parent directories): .git
Building flutter tool...
Running pub upgrade...
Upgrading Flutter to 2.0.6 from 2.0.1 in F:\src\flutter...
fatal: not a git repository (or any of the parent directories): .git
Checking Dart SDK version...
Downloading Dart SDK from Flutter engine 05e680e202af9a92461070cb2d9982acad46c83c...
Building flutter tool...
Running pub upgrade...
Upgrading engine...
fatal: not a git repository (or any of the parent directories): .git
Building flutter tool...
Running pub upgrade...
Downloading android-arm-profile/windows-x64 tools... 2 699ms
Downloading android-arm-release/windows-x64 tools... 1 329ms
Downloading android-arm64-profile/windows-x64 tools... 1 476ms
Downloading android-arm64-release/windows-x64 tools... 1 992ms
Downloading android-x64-profile/windows-x64 tools... 1 517ms
Downloading android-x64-release/windows-x64 tools... 1 096ms
Downloading android-x86 tools... 16,9s
Downloading android-x64 tools... 16,9s
Downloading android-arm tools... 7,7s
Downloading android-arm-profile tools... 3,9s
Downloading android-arm-release tools... 3,3s
Downloading android-arm64 tools... 8,3s
Downloading android-arm64-profile tools... 4,0s
Downloading android-arm64-release tools... 3,5s
Downloading android-x64-profile tools... 5,0s
Downloading android-x64-release tools... 3,8s
Downloading android-x86-jit-release tools... 5,6s
Downloading Web SDK... 18,8s
Flutter 2.0.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 1d9032c7e1 (12 days ago) • 2021-04-29 17:37:58 -0700
Engine • revision 05e680e202
Tools • Dart 2.12.3
Running flutter doctor...
fatal: not a git repository (or any of the parent directories): .git
Building flutter tool...
Running pub upgrade...
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.6, on Microsoft Windows [Version 10.0.19042.928], locale pl-PL)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] Connected device (3 available)
! Doctor found issues in 1 category.
颤振医生-vv:
F:\src\flutter>flutter doctor -vv
fatal: not a git repository (or any of the parent directories): .git
Building flutter tool...
Running pub upgrade...
[ +111 ms] executing: [F:\src\flutter/] git -c log.showSignature=false log -n 1
--pretty=format:%H
[ +107 ms] Exit code 0 from: git -c log.showSignature=false log -n 1
--pretty=format:%H
[ +1 ms] a5cdb02597b2f35c484238501982a987f7c70c60
[ +1 ms] executing: [F:\src\flutter/] git tag --points-at
a5cdb02597b2f35c484238501982a987f7c70c60
[ +74 ms] Exit code 0 from: git tag --points-at
a5cdb02597b2f35c484238501982a987f7c70c60
[ +2 ms] executing: [F:\src\flutter/] git describe --match *.*.* --long --tags
a5cdb02597b2f35c484238501982a987f7c70c60
[ +100 ms] Exit code 0 from: git describe --match *.*.* --long --tags
a5cdb02597b2f35c484238501982a987f7c70c60
[ +1 ms] 2.0.6-1-ga5cdb02597
[ +66 ms] executing: [F:\src\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +67 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/stable
[ ] executing: [F:\src\flutter/] git ls-remote --get-url origin
[ +58 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ +104 ms] executing: [F:\src\flutter/] git rev-parse --abbrev-ref HEAD
[ +73 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] stable
[ +102 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required,
skipping update.
[ +2 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required,
skipping update.
[ +2 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping
update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +5 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping
update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping
update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping
update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required,
skipping update.
[ +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required,
skipping update.
[ +1 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required,
skipping update.
[ +1 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required,
skipping update.
[ +70 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[ +2 ms] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[ +1 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required,
skipping update.
[ +1 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required,
skipping update.
[ +1 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping
update.
[ +1 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[ ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping
update.
[ +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping
update.
[ +1 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping
update.
[ +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required,
skipping update.
[ +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required,
skipping update.
[ +1 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required,
skipping update.
[ +1 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required,
skipping update.
[ +1 ms] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping
update.
[ +1 ms] Artifact Instance of 'PubDependencies' is not required, skipping update.
[ +23 ms] executing: [F:\src\flutter/] git rev-parse --abbrev-ref HEAD
[ +67 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ +1 ms] stable
[ +1 ms] Skipping request to fetchTags - on well known channel stable.
[ ] executing: [F:\src\flutter/] git tag --points-at HEAD
[ +71 ms] Exit code 0 from: git tag --points-at HEAD
[ +1 ms] executing: [F:\src\flutter/] git describe --match *.*.* --long --tags
HEAD
[ +85 ms] Exit code 0 from: git describe --match *.*.* --long --tags HEAD
[ +1 ms] 2.0.6-1-ga5cdb02597
[ +12 ms] executing: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ +183 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jre\bin\java
-version
[ +2 ms] openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
OpenJDK 64-Bit Server VM (build 11.0.8+10-b944.6842174, mixed mode)
[ +12 ms] executing: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ +187 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jre\bin\java
-version
[ +2 ms] openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
OpenJDK 64-Bit Server VM (build 11.0.8+10-b944.6842174, mixed mode)
[ +20 ms] executing: [F:\src\flutter/] git -c log.showSignature=false log -n 1
--pretty=format:%ar
[ +62 ms] Exit code 0 from: git -c log.showSignature=false log -n 1
--pretty=format:%ar
[ +1 ms] 26 minutes ago
[ +77 ms] java -version
[ +25 ms] executing: F:\src\flutter\platform-tools\adb.exe devices -l
[ +34 ms] [√] Flutter (Channel stable, 2.0.7-0.0.pre.1, on Microsoft Windows
[Version
10.0.19042.928], locale pl-PL)
[ +4 ms] • Flutter version 2.0.7-0.0.pre.1 at F:\src\flutter
[ +2 ms] • Framework revision a5cdb02597 (26 minutes ago), 2021-05-14
15:23:36 +0200
[ +1 ms] • Engine revision 05e680e202
[ +1 ms] • Dart version 2.12.3
|[ +131 ms] List of devices attached
/[ +134 ms] executing: F:\src\flutter\platform-tools\adb.exe devices -l
-[ +71 ms] List of devices attached
[+5681 ms] [√] Android toolchain - develop for Android devices (Android SDK version
30.0.3)
[ +2 ms] • Android SDK at F:\src\flutter
[ +1 ms] • Platform android-30, build-tools 30.0.3
[ +1 ms] • Java binary at: C:\Program Files\Android\Android
Studio\jre\bin\java
[ +1 ms] • Java version OpenJDK Runtime Environment (build
11.0.8+10-b944.6842174)
[ +1 ms] • All Android licenses accepted.
[ +3 ms] [√] Chrome - develop for the web
[ +1 ms] • Chrome at C:\Program Files
(x86)\Google\Chrome\Application\chrome.exe
[ +3 ms] [√] Android Studio (version 4.1.0)
[ +1 ms] • Android Studio at C:\Program Files\Android\Android Studio
[ +3 ms] • Flutter plugin can be installed from:
[ ] https://plugins.jetbrains.com/plugin/9212-flutter
[ ] • Dart plugin can be installed from:
[ ] https://plugins.jetbrains.com/plugin/6351-dart
[ +1 ms] • Java version OpenJDK Runtime Environment (build
11.0.8+10-b944.6842174)
[ +2 ms] [√] Connected device (2 available)
[ +1 ms] • Chrome (web) • chrome • web-javascript • Google Chrome
90.0.4430.212
[ +1 ms] • Edge (web) • edge • web-javascript • Microsoft Edge
90.0.818.56
[ +1 ms] • No issues found!
[ +15 ms] "flutter doctor" took 7 075ms.
[ +160 ms] ensureAnalyticsSent: 154ms
[ +3 ms] Running shutdown hooks
[ +1 ms] Shutdown hooks complete
[ +1 ms] exiting with code 0
如果有人能指导我解决我的问题,我会很高兴。我希望这是一件小事,但我无法处理。 问候
2021 年 5 月 15 日编辑
我提供了 C:\ 目录中预期的 pubspec.yaml 文件的其他错误,这可能有助于解决此问题:
f:\test>flutter create --sample=material.AppBar.1 mysample
fatal: not a git repository (or any of the parent directories): .git
Building flutter tool...
Running pub upgrade...
Creating project mysample...
mysample\.gitignore (created)
mysample\.idea\libraries\Dart_SDK.xml (created)
mysample\.idea\libraries\KotlinJavaRuntime.xml (created)
mysample\.idea\modules.xml (created)
mysample\.idea\runConfigurations\main_dart.xml (created)
mysample\.idea\workspace.xml (created)
mysample\.metadata (created)
mysample\android\app\build.gradle (created)
mysample\android\app\src\main\kotlin\com\example\mysample\MainActivity.kt (created)
mysample\android\build.gradle (created)
mysample\android\mysample_android.iml (created)
mysample\android\.gitignore (created)
mysample\android\app\src\debug\AndroidManifest.xml (created)
mysample\android\app\src\main\AndroidManifest.xml (created)
mysample\android\app\src\main\res\drawable\launch_background.xml (created)
mysample\android\app\src\main\res\drawable-v21\launch_background.xml (created)
mysample\android\app\src\main\res\mipmap-hdpi\ic_launcher.png (created)
mysample\android\app\src\main\res\mipmap-mdpi\ic_launcher.png (created)
mysample\android\app\src\main\res\mipmap-xhdpi\ic_launcher.png (created)
mysample\android\app\src\main\res\mipmap-xxhdpi\ic_launcher.png (created)
mysample\android\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png (created)
mysample\android\app\src\main\res\values\styles.xml (created)
mysample\android\app\src\main\res\values-night\styles.xml (created)
mysample\android\app\src\profile\AndroidManifest.xml (created)
mysample\android\gradle\wrapper\gradle-wrapper.properties (created)
mysample\android\gradle.properties (created)
mysample\android\settings.gradle (created)
mysample\ios\Runner\AppDelegate.swift (created)
mysample\ios\Runner\Runner-Bridging-Header.h (created)
mysample\ios\Runner.xcodeproj\project.pbxproj (created)
mysample\ios\Runner.xcodeproj\xcshareddata\xcschemes\Runner.xcscheme (created)
mysample\ios\.gitignore (created)
mysample\ios\Flutter\AppFrameworkInfo.plist (created)
mysample\ios\Flutter\Debug.xcconfig (created)
mysample\ios\Flutter\Release.xcconfig (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Contents.json (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-1024x1024@1x.png (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-20x20@1x.png (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-20x20@2x.png (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-20x20@3x.png (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-29x29@1x.png (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-29x29@2x.png (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-29x29@3x.png (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-40x40@1x.png (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-40x40@2x.png (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-40x40@3x.png (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-60x60@2x.png (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-60x60@3x.png (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-76x76@1x.png (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-76x76@2x.png (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-83.5x83.5@2x.png (created)
mysample\ios\Runner\Assets.xcassets\LaunchImage.imageset\Contents.json (created)
mysample\ios\Runner\Assets.xcassets\LaunchImage.imageset\LaunchImage.png (created)
mysample\ios\Runner\Assets.xcassets\LaunchImage.imageset\LaunchImage@2x.png (created)
mysample\ios\Runner\Assets.xcassets\LaunchImage.imageset\LaunchImage@3x.png (created)
mysample\ios\Runner\Assets.xcassets\LaunchImage.imageset\README.md (created)
mysample\ios\Runner\Base.lproj\LaunchScreen.storyboard (created)
mysample\ios\Runner\Base.lproj\Main.storyboard (created)
mysample\ios\Runner\Info.plist (created)
mysample\ios\Runner.xcodeproj\project.xcworkspace\contents.xcworkspacedata (created)
mysample\ios\Runner.xcodeproj\project.xcworkspace\xcshareddata\IDEWorkspaceChecks.plist (created)
mysample\ios\Runner.xcodeproj\project.xcworkspace\xcshareddata\WorkspaceSettings.xcsettings (created)
mysample\ios\Runner.xcworkspace\contents.xcworkspacedata (created)
mysample\ios\Runner.xcworkspace\xcshareddata\IDEWorkspaceChecks.plist (created)
mysample\ios\Runner.xcworkspace\xcshareddata\WorkspaceSettings.xcsettings (created)
mysample\lib\main.dart (created)
mysample\mysample.iml (created)
mysample\pubspec.yaml (created)
mysample\README.md (created)
mysample\test\widget_test.dart (created)
mysample\web\favicon.png (created)
mysample\web\icons\Icon-192.png (created)
mysample\web\icons\Icon-512.png (created)
mysample\web\index.html (created)
mysample\web\manifest.json (created)
Could not find a file named "pubspec.yaml" in "C:\".
Running "flutter pub get" in mysample...
pub get failed (66; Could not find a file named "pubspec.yaml" in "C:\".)
【问题讨论】:
标签: git flutter android-studio