Git Not Working With Claude Code on Windows

Share

If Claude Code can’t see Git on Windows, the problem is usually the shell or PATH, not Git itself. The fix is to check `git --version` in the exact terminal Claude Code uses, then correct PATH, shell choice, or the repo location if needed. If you’re using WSL, make sure you’re fixing the Git install inside WSL, not the Windows one.

What it usually looks like when Claude Code can’t see Git on Windows

The symptoms are usually simple but confusing: git is treated like an unknown command, Claude Code says Git is unavailable, or a Git operation starts and then stalls. Sometimes the app can read the repo but can’t commit, branch, or check status. In other cases, Git works in one terminal window and fails in another, which usually means the shell or environment is different.

If you see an error that looks like this, the issue is usually visibility rather than a broken Git install:

'git' is not recognized as an internal or external command, operable program or batch file.
Error

You can also run into silent failure, where Claude Code waits forever or reports that it cannot find a repository even though the folder is correct. That often points to a path, permissions, shell, or WSL boundary problem instead of a Git bug.

Where this breaks on Windows most often

Before you change anything, check which layer is actually failing. On Windows, the common causes are:

  • Git is not installed at all.
  • Git is installed, but its cmd or bin folder is not on PATH for the shell Claude Code uses.
  • Claude Code is running in PowerShell, Command Prompt, Git Bash, or WSL, and only one of those shells can see Git.
  • Claude Code is connected to a different user account than the one that has Git set up.

WSL is a special case. If Claude Code is running inside WSL, Windows Git does not automatically count as available there, and the reverse is true too. A repo under the Windows file system may still work, but the environment is different enough that commands can fail in ways that look like a Git problem when they are really a shell boundary problem.

Before you start: This applies to Claude Code on Windows with Git installed locally, whether you use PowerShell, Command Prompt, Git Bash, or WSL. You usually do not need Administrator rights just to check Git, but installing or fixing a system PATH may require them. No backup is needed for the first checks, and a restart of the terminal or Claude Code is often part of the fix.

Safe first checks:

  • Open the same terminal Claude Code uses and run git --version.
  • Confirm the repo folder is somewhere local, like C:\dev\project, not inside a synced or protected folder.
A Windows laptop with Command Prompt open beside Git folders on the screen.

The fastest fix that solves most cases

Start with the least risky checks. If Git is installed and visible in the same terminal session Claude Code uses, most of the common failures disappear right there.

  1. Check Git from that exact shell.
git --version
PowerShell

If Git is working, you should see a version string. If you get an error about git not being recognized, the shell cannot see Git yet.

  1. Close and reopen the terminal, then restart Claude Code.

This matters because PATH changes often do not show up in already-open windows. If Git was installed or updated after Claude Code started, that app may still be using the old environment.

  1. If Git is not found, confirm the install in Windows.

Open the Start menu and look for Git-related tools, or check the install location you expect. If Git is installed, the next step is usually to fix PATH rather than reinstalling right away.

  1. Make sure the same shell can run a simple Git command in the repo.
git status
PowerShell

Expected result: Git prints the current branch and working tree state. If this works in the terminal Claude Code uses, but Claude Code still fails, the problem is likely inside Claude Code’s shell configuration or repo handling.

If git --version fails everywhere, Git is not available to Windows in the way the shell expects. If it works in one terminal and not another, you are dealing with a shell or PATH mismatch, not a missing Git install.

If Git works in one terminal but not in Claude Code

This is the most common Windows-only case. The fix is to compare the shell Claude Code is using with the shell where Git works.

  1. Check the shell in both places.

If Git works in Git Bash but not in PowerShell, or works in PowerShell but not in WSL, that tells you the issue is environment-specific.

  1. Compare PATH from the working shell and the failing shell.
echo $env:Path
PowerShell
echo %PATH%
Command Prompt

You are looking for the Git install path, often something like C:\Program Files\Git\cmd. If that path is missing in the failing shell, Claude Code will not find Git there.

  1. Check the executable path.
where git
PowerShell

Expected result: one or more paths to git.exe. If where git finds Git in one shell but not in the other, you have confirmed a PATH visibility problem.

  1. Fix the shell choice instead of forcing a mixed setup.

If Claude Code is intended to run in PowerShell, make sure Git is on the Windows PATH used by PowerShell. If you prefer Git Bash, run Claude Code in that same environment. If you are using WSL, install Git inside WSL and keep the repo and tools in that environment.

If the command works in the terminal but not inside Claude Code itself, that usually means Claude Code launched before PATH changed, or it is using a different shell than you think.

Windows quirks that can make Git look broken

Some failures are not about Git being missing. They are about Windows path, sync, or permission behavior getting in the way.

Line endings can cause noisy diffs or repeated changes after commits. That does not usually stop Git from running, but it can make the repo seem broken because files keep changing. If your team uses a specific line-ending setup, keep it consistent in the repo and editor.

Paths with spaces are usually fine, but very long or deeply nested paths can still cause trouble for older tools and some repo operations. A simple local path like C:\dev\app is easier to work with than a long folder under several synced directories.

OneDrive and other synced folders can interfere with Git. Files may be locked, moved, or synced at the wrong moment, which makes status checks, commits, or file writes fail. If your repo lives under Documents, Desktop, or another protected folder, move it to a normal local development folder and test again.

If the repo is in a protected folder, do not start by changing Git settings or force-deleting files. First move or copy the repo to a plain local folder and test there.

Permission issues can also show up when Claude Code runs under one account and Git was installed or configured under another. Keep the install and the repo under the same user profile when possible, and avoid mixing a user-level Git install with a different account session unless you know why you need it.

How to check that it’s actually fixed

Verify the fix in the same shell and session Claude Code uses. If you test in a different terminal, you can get a false pass.

  1. Open the terminal Claude Code relies on.
  2. Go to the repository folder.
  3. Run a basic status check.
git status
PowerShell

Expected result: Git prints the branch name and working tree state instead of an error.

  1. Check that branch lookup works.
git branch
PowerShell

Expected result: Git lists branches, with the current branch marked.

  1. Make a tiny, reversible test if you want to confirm write access.

Create or edit a small file, then run:

git diff
PowerShell

Expected result: Git shows the change. If you want a full end-to-end test, create a small commit only if you are in a safe test branch or a disposable repo.

If git status works but Claude Code still fails, the Git install is fine and the remaining issue is likely how Claude Code launches its shell, which account it runs under, or which repo path it is opening.

How to keep it from breaking again

Once it works, keep the setup boring. That usually prevents the same failure from coming back.

  • Keep Git installed in the normal Windows PATH for the shell you actually use.
  • Use one shell for Claude Code and your regular Git work, or be very clear about which shell each tool uses.
  • Keep projects in a local folder such as C:\dev instead of OneDrive, Desktop, or Documents if those folders are synced or protected on your machine.
  • Avoid moving the repo between WSL and native Windows unless you mean to work in both environments and understand the boundary.
  • After changing Git or PATH, restart the terminal and Claude Code so they pick up the new environment.

If you tend to switch shells often, write down which one is your default for coding work. A simple habit like that prevents a lot of “Git disappeared” confusion.

When the problem is really Claude Code, not Git

If git --version, git status, and where git all work in the same shell, Git is probably fine. At that point, suspect Claude Code’s own configuration, its launch environment, or how it is invoking the shell.

That is the point to collect a few details before you ask for help or go deeper:

  • The exact error text.
  • Which shell you were using: PowerShell, Command Prompt, Git Bash, or WSL.
  • The output of git --version and where git in that same shell.
  • The repo path.
  • Whether the repo lives in OneDrive or another synced folder.

If Claude Code only fails when it is launched from one place, but Git works everywhere else, that points to the app startup environment rather than Git itself. If you can run the same Git command successfully in the same terminal session, the next step is usually app-side troubleshooting rather than reinstalling Git.

Conclusion

Start by running `git --version` in the exact terminal Claude Code uses. If that works, check PATH, repo location, and whether you are mixing PowerShell, Git Bash, and WSL; if it does not, fix Git visibility first, then retry `git status` in the same session.

Frequently Asked Questions

Should I use Git Bash, PowerShell, or WSL with Claude Code on Windows?

Use the shell Claude Code is actually configured to use, and keep Git available in that same environment. Mixing Windows Git, Git Bash, and WSL is where most of the confusion starts.

Do I need to reinstall Git if Claude Code can’t find it?

Usually no. First check `git --version` and `where git` in the same terminal session Claude Code uses. If Git is installed but not visible there, PATH, shell, or user-account setup is the real issue.

Why does Git work in one terminal but not in Claude Code?

That usually means Claude Code is using a different shell, a different PATH, or a different user account. It can also happen if Claude Code started before you changed the environment and has not been restarted.

Read more