Try the demo

The term 'git' is not recognized as the name of a cmdlet

PowerShell can't find git.exe in the folders on its PATH.

The error

PS> git status
git : The term 'git' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.

PowerShell 7 words it a little differently:

git: The term 'git' is not recognized as a name of a cmdlet, function, script file, or executable program.

Why it happens

PowerShell runs git by looking for git.exe in each folder on PATH. It finds none when:

  • Git isn't installed.
  • Git for Windows was installed with Use Git from Git Bash only, which leaves PATH alone. The default choice adds C:\Program Files\Git\cmd.
  • The terminal, editor or agent app started before Git was installed or PATH changed. A program keeps the PATH it started with, and every shell it opens gets that copy, so agents working in it can't find Git either.
  • A tool starts PowerShell with a PATH of its own that leaves Git out.

The fix

First see whether Git is there at all:

Get-Command git                                 # nothing: not on this PATH
Test-Path 'C:\Program Files\Git\cmd\git.exe'    # True: installed, just not found

If it isn't installed, install Git for Windows. If it is, and the app was open while it was installed, restart the app. To add it to PATH for this session only:

$env:Path += ';C:\Program Files\Git\cmd'
git --version

To keep it, open Edit environment variables for your account from the Start menu, add C:\Program Files\Git\cmd to Path, and restart the apps that should see it.

Or call Git by its full path, with the call operator & because the path is quoted:

& 'C:\Program Files\Git\cmd\git.exe' status --short

How DMN learned it

It came up, and was fixed, in 7 of our own sessions. DMN kept the fix as one line: In PowerShell, git is not on PATH; invoke it by full path with the call operator: & 'C:\Program Files\Git\cmd\git.exe' status --short (same for other git subcommands).

DMN reads your agents' past sessions on your machine. When the same error is fixed the same way in two or more of them, it keeps the fix as a one-line lesson. When the error turns up again, Claude Code is told the fix straight away, and any agent can search what earlier sessions found. How DMN keeps what agents learn.

Stop fixing the same error twice