Running flutter prints 'Error: Unable to find git in your PATH'
Error: Unable to find git in your PATH.Short answer
The flutter launcher script runs git before anything else. If the shell cannot find a git program, or the SDK folder has no .git entry, it stops with this error. Install git, open a new terminal so it sees the updated PATH, and use a Flutter SDK that was installed as documented.
Fix it fast
1Find out which cause you have
Ask the same shell where git is. If this prints a path, git is fine and you should look at the SDK folder; if it prints nothing, git is not on the PATH of this terminal.
command -v git echo "$PATH"2Match what you see, then jump to its fix
- 1
command -v git prints nothing and a fresh shell has the same resultgit is not installedFix - 2
git works in one terminal window and fails in another, or only inside an editor's terminalgit is installed, but this terminal or IDE started before it was added to PATHFix - 3
Error: The Flutter directory is not a clone of the GitHub project.The SDK folder is a downloaded archive, not a git cloneFix
- 1
What does the error look like?
Error: Unable to find git in your PATH.Error: The Flutter directory is not a clone of the GitHub project.The flutter tool requires Git in order to operate properly;
Cause 1 of 3
git is not installed
1Check
Flutter's install guide lists git as a requirement: on Linux it sits in the package list with curl and unzip, and on macOS it comes with the Xcode command-line tools.
git --version2Fix
On Ubuntu install the packages from Flutter's list. On macOS install the command-line tools; Apple notes that on a fresh system running a tool such as git also offers to install them.
# Ubuntu / Debian
sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa
# macOS
xcode-select --install3Verify
git answers, and flutter starts.
git --version
flutter --versionConfirmed by docs.flutter.dev
Cause 2 of 3
git is installed, but this terminal or IDE started before it was added to PATH
1Check
Flutter's guide tells you to close and reopen terminals and IDEs after a PATH change. Compare the result in the failing window with a window that works.
command -v git
which -a git2Fix
Quit the editor completely and start it again so it reads the new environment. For a Git Bash session on Windows, choose the installer option that puts git on the command line, as the Git for Windows setup describes, then open a new window.
# Git for Windows installer, PATH step:
# "Git from the command line and also from 3rd-party software"3Verify
In the failing window, git is found and flutter runs.
command -v git
flutter doctorConfirmed by docs.flutter.dev
Cause 3 of 3
The SDK folder is a downloaded archive, not a git clone
1Check
The launcher script tests for a .git entry in the SDK root and exits when it is missing; git is then needed to read the SDK revision. Look inside the folder that holds bin/flutter.
ls -a "$(dirname "$(dirname "$(command -v flutter)")")" | head -n 202Fix
Remove the copied or re-packed folder, extract the official SDK archive again as the install guide shows, and point PATH at its bin folder. Do not copy the SDK around without its hidden .git entry.
# macOS, example file name from the install guide
unzip ~/Downloads/flutter_macos_3.50.0-stable.zip -d ~/develop/
export PATH="$HOME/develop/flutter/bin:$PATH"3Verify
flutter runs and prints its version.
flutter --versionConfirmed by raw.githubusercontent.com
How do I stop it coming back?
- Install git before the Flutter SDK, on every new machine and CI image.
- Install the SDK from the official archive and never copy the folder without its hidden .git entry.
- After any PATH change, restart your editor as well as the terminal.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
- Qist BazaarA buy-now-pay-later marketplace built from a blank repo, now past 100K downloads on Google Play.
Related fixes
Mobile apps
The terminal cannot find the flutter or dart command
zsh: command not found: flutter
The flutter and dart programs both live in the bin folder of the Flutter SDK, so one PATH entry gives you both.
3 causes, each with a fixMobile apps
Terminal says fvm: command not found after installing FVM
zsh: command not found: fvm
The shell cannot find an fvm executable.
2 causes, each with a fixMobile apps
A phone is plugged in over USB but Android Studio and adb do not list it
adb devices prints List of devices attached with nothing below it
adb lists a phone only when four things hold: USB debugging is on, you accepted the computer's RSA key on the phone, the computer has a driver or udev rule for the device, and the cable carries data to a running adb server.
6 causes, each with a fixMobile apps
Apple rejected the app under Guideline 4.3, Design: Spam
Guideline 4.3(b) - Design - Spam
Guideline 4.3 is Apple's duplicate rule.
5 causes, each with a fixMobile apps
pod install says 'You cannot run CocoaPods as root'
[!] You cannot run CocoaPods as root.
CocoaPods has refused to run as root since version 0.32.0, because root-owned files can leave it in a broken state.
3 causes, each with a fixMobile apps
pod install cannot pick a version of a pod that satisfies every requirement
Specs satisfying the `FirebaseAuth (~> 11.0)` dependency were found, but they required a higher minimum deployment target.
CocoaPods tried every version of the named pod and none fit all requirements.
4 causes, each with a fix