This error typically indicates that a corrupted or misconfigured Git installation or environment variable is interfering with Flutter’s access to Git.
Let’s go step-by-step to fix this:
Run this in Command Prompt (not PowerShell):
git --version
If this triggers the "select an app to open 'git'" prompt, your system doesn't recognise Git correctly.
Press Win + S
, search for Environment Variables
.
Open Environment Variables > System Variables
.
Find the Path
variable, click Edit.
Ensure Git's bin
and cmd
paths are present, e.g.:
C:\Program Files\Git\cmd
C:\Program Files\Git\bin
Click OK to save.
If you installed Git via GitHub Desktop or another non-standard path, make sure those entries are removed and only valid paths exist.
Check if there's a GIT_*
environment variable that might be interfering:
In the same Environment Variables window, look under User Variables and System Variables for:
GIT_EXEC_PATH
GIT_TEMPLATE_DIR
Any other GIT_*
variables
If found and you’re not explicitly using them, delete them.
Restart your machine to apply all changes, then try:
flutter doctor
Open your .bashrc
(if using Git Bash) or set Git path manually in flutter.bat
(not usually needed, but in extreme cases):
set GIT_EXECUTABLE=C:\Program Files\Git\bin\git.exe
flutter doctor