Issue
I'm new in Flutter/Dart/Git and I am stuck in one place since few weeks. I have already made some simple projects using Flutter/Android Studio on few other machines and this problem doesn't exist. It just works fine. I want to use this software on my main computer without using the remote desktop... My OS is Windows 10.
Everytime I hit any flutter command I receive the same error:
fatal: not a git repository (or any of the parent directories): .git
Building flutter tool...
Running pub upgrade...
Following solutions didn't work for me:
- delete ./pub-cache folder, pub cache repair
- git init / git clone
- flutter clean
- flutter create --sample=material.AppBar.1 mysample
- copy working project from other computer
- running commands from a project directory eg. C:\Users\User\AndroidStudioProjects\MyProject\
- reinstall everything I use: Flutter, Android Studio, Git
- disable antivirus / remove flutter files from quarantine
- probably some others
EDIT 18 May 2021
I found out that everyrything works fine on my main machine, but after logging on an other windows user account. So it probably should be something wrong with my user settings. I tried to delete everything related to dart/flutter/android in my user directory C:\Users\User. After that I deleted F:\src directory, uninstalled git again, cloned flutter. Unfortunatelly the error still occurs... I have no idea what more can I do... It looks as an simple change in an config file but which one?
Git commands look to work fine, e.g.
C:\>git --version
git version 2.30.1.windows.1
Git status
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)
Everything is up to date e.g. flutter:
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.
Flutter doctor -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
I would be glad if somebody will guide me to solving my problem. I hope it is a trifle but I can't handle this. Regards
Edit 15 May 2021
I provide additional error with pubspec.yaml file expected in C:\ directory which may be useful solving this problem:
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\[email protected] (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\[email protected] (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\[email protected] (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\[email protected] (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\[email protected] (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\[email protected] (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\[email protected] (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\[email protected] (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\[email protected] (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\[email protected] (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\[email protected] (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\[email protected] (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\[email protected] (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\[email protected] (created)
mysample\ios\Runner\Assets.xcassets\AppIcon.appiconset\[email protected] (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\[email protected] (created)
mysample\ios\Runner\Assets.xcassets\LaunchImage.imageset\[email protected] (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:\".)
Solution
I had this same issue. I tinkered with my command prompt settings... I wanted to have my command prompt automatically open in a specific directory, so I added an Auto Run option to my registry. This actually caused the same error you are seeing here. Is there something similar in your environment that is causing the command to run in the wrong directory? For reference, I had to delete the key AutoRun from the path HKEY_CURRENT_USER\Software\Microsoft\Command Processor, which solves my flutter issue.
Answered By - William Herrmann
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.