[BUG]Claude Code VS Code Extension Fails to Detect Git Bash on Windows Despite Correct Configuration

Resolved 💬 68 comments Opened Oct 1, 2025 by GoldKingai Closed Apr 8, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

[BUG] Claude Code VS Code Extension Fails to Detect Git Bash on Windows Despite Correct Configuration

Environment

  • Platform: Anthropic API
  • Claude Code Extension Version: 2.0.2 (released 2025-10-01)
  • Operating System: Windows 11
  • VS Code Version: [Please fill in your version from Help → About]
  • Terminal: PowerShell 5.x with Python virtual environment
  • Git Version: 2.50.0.windows.2

Bug Description

The Claude Code VS Code extension consistently fails to detect Git Bash installation on Windows, displaying the error:

Error: Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). If installed but not in PATH, set environment variable pointing to your bash.exe, similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe

This occurs despite:

  1. Git Bash being properly installed and functional
  2. Correct environment variable configuration
  3. Bash executable being accessible and working
  4. Multiple troubleshooting attempts including path modifications

Steps to Reproduce

  1. Install Git for Windows with Git Bash
  2. Install Claude Code VS Code extension (version 2.0.2)
  3. Verify Git Bash works: & "C:\Program Files\Git\bin\bash.exe" --version
  4. Set environment variable: $env:CLAUDE_CODE_GIT_BASH_PATH = "C:\Program Files\Git\bin\bash.exe"
  5. Attempt to use Claude Code extension in VS Code
  6. Observe the git-bash error despite correct configuration

Expected Behavior

The extension should detect Git Bash either through:

  • Automatic detection from system PATH
  • Environment variable CLAUDE_CODE_GIT_BASH_PATH
  • VS Code terminal environment settings

Actual Behavior

Extension displays git-bash error and refuses to function, blocking all productivity workflows.

Troubleshooting Attempts Made

Environment Variable Configuration

  • Set both user and system environment variables
  • Tried both C:\Program Files\Git\bin\bash.exe and space-free symbolic link C:\GitBash\bin\bash.exe
  • Verified variables are visible in VS Code terminal sessions
  • Added to VS Code settings.json terminal.integrated.env.windows

PATH Configuration

  • Added C:\Program Files\Git\bin to system PATH
  • Added C:\Program Files\Git\cmd to system PATH
  • Verified git --version works (showing PATH is functional)
  • Created symbolic link without spaces: C:\GitBashC:\Program Files\Git

Extension Troubleshooting

  • Downgraded from version 2.0.2 to 2.0.1 (same error)
  • Completely uninstalled and reinstalled extension
  • Reloaded VS Code window multiple times
  • Restarted VS Code completely
  • Cleared VS Code settings and reconfigured

Terminal Configuration

  • Tested with PowerShell, Command Prompt, and Git Bash terminals
  • Changed VS Code default terminal profile
  • Verified bash works in all terminal types

Verification Commands That Work

All of these commands execute successfully, proving the installation is correct:

# Direct execution
& "C:\Program Files\Git\bin\bash.exe" --version
# Output: GNU bash, version 5.2.37(1)-release (x86_64-pc-msys)

# Environment variable execution  
& $env:CLAUDE_CODE_GIT_BASH_PATH --version
# Output: GNU bash, version 5.2.37(1)-release (x86_64-pc-msys)

# Git command works
git --version
# Output: git version 2.50.0.windows.2

# Environment variable is set
echo $env:CLAUDE_CODE_GIT_BASH_PATH  
# Output: C:\Program Files\Git\bin\bash.exe

Related Issues

This appears related to known issues with Git Bash path detection:

  • Issue #4507: Git Bash path with spaces in "Program Files"
  • Issue #3461: CLI fails with "No suitable shell found"
  • Issue #2602: Git Bash path conversion issues

Impact

This bug completely blocks the use of Claude Code VS Code extension, preventing:

  • Integrated AI-assisted coding workflows
  • Real-time code editing and suggestions
  • File management through the extension
  • All productivity features that require the extension

The CLI version works but lacks the integrated VS Code experience needed for effective development workflow.

System Configuration Details

# Working Git installation
PS> git --version
git version 2.50.0.windows.2

# Working Bash installation  
PS> & "C:\Program Files\Git\bin\bash.exe" --version
GNU bash, version 5.2.37(1)-release (x86_64-pc-msys)

# Correct environment variable
PS> $env:CLAUDE_CODE_GIT_BASH_PATH
C:\Program Files\Git\bin\bash.exe

# PATH includes Git
PS> $env:PATH -split ';' | Where-Object { $_ -like "*Git*" }
C:\Program Files\Git\cmd

Request

This issue is blocking productive use of Claude Code for software development. Please prioritize fixing the VS Code extension's Git Bash detection mechanism on Windows, particularly:

  1. Proper handling of paths with spaces (Program Files)
  2. Reliable environment variable detection
  3. Fallback detection methods when automatic detection fails

Additional Information

Available for testing any proposed fixes or providing additional diagnostic information as needed.

What Should Happen?

Error: Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). If installed but not in PATH, set environment variable pointing to your bash.exe, similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe

Error Messages/Logs

Error: Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). If installed but not in PATH, set environment variable pointing to your bash.exe, similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe

Steps to Reproduce

Error: Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). If installed but not in PATH, set environment variable pointing to your bash.exe, similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.0.2

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

_No response_

View original on GitHub ↗

68 Comments

github-actions[bot] · 9 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/7420
  2. https://github.com/anthropics/claude-code/issues/5887
  3. https://github.com/anthropics/claude-code/issues/7470

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

silviapolizzi · 9 months ago

I have the same error

Luminlight · 9 months ago

Same issue here.
I checked my environment variables, and there were quite a few no longer present.

  • System32\WindowsPowerShell\V1.0\
  • Git\cmd\
  • Git\bin\
  • etc

A Windows update may have modified these, but not sure.

I added the system environment variables and restarted. The Claude extension still displays the error, and any prompts made through the extension indefinitely hang. The Claude CLI works fine, however.

The Claude extension has been updated twice since discovering this bug report: 2.0.2 -> 2.0.3 & 2.0.5
Installing specific versions doesn't seem to modify this behavior, with each version displaying the same error: "Error: Claude Code on Windows requires git-bash".

I did not go through the entire version list. Specific version installs I have tried:

  • 2.0.5
  • 2.0.3
  • 2.0.2
  • 2.0.0

Update:
Installing an older version, as suggested by @GoldKingai, has worked.

Update v2:
Adding C:\Windows\System32\ to the system PATH has resolved my issue. Both the CLI and VSCode extension work as intended.

freshmediaro · 9 months ago

Same error here! 😢

LukasdeSouza · 9 months ago

Same here. Now i'm only using Claude Code in my terminal because I can't use the extension from Visual Studio Code

GoldKingai · 9 months ago

@Luminlight @silviapolizzi @LukasdeSouza @freshmediaro Try going back to an older version, because the older versions seem to work, it's the newer versions that's giving problems

seoflyyy · 9 months ago

Same issue! Fix it, Claude!

Light-Bobine · 9 months ago

Same issue here. The older extension version works for me, thanks to @GoldKingai for his workaround.

YomarFerreira · 9 months ago

Same issue! Fix it, Claude!

avnmurthy · 9 months ago

I had the same error for last 3 days.
I reverted to version 1.0.117 and it worked

lchabin · 9 months ago

1.0.126 may be the last one working when it comes to the bash problem.
cherry on top : does not work for me due to exec policies that are not properly set...... shame
I am supposed to do that myself ?????
If i start bash in the terminal of the extension, then i can call claude, but its 2.0.9..... what a mess. I bet it won't make use of the IDE.
I just started my subscription, bad experience. Can I be not charged until it works in vscode ?

PS C:\WINDOWS\system32> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Modification de la stratégie d'exécution
La stratégie d’exécution permet de vous prémunir contre les scripts que vous jugez non fiables. En modifiant la
stratégie d’exécution, vous vous exposez aux risques de sécurité décrits dans la rubrique d’aide
about_Execution_Policies à l’adresse https://go.microsoft.com/fwlink/?LinkID=135170. Voulez-vous modifier la stratégie
d’exécution ?

So essentially, i need to make my machine unsecure

silviapolizzi · 9 months ago
@Luminlight @silviapolizzi @LukasdeSouza @freshmediaro Try going back to an older version, because the older versions seem to work, it's the newer versions that's giving problems

Fixed following this guide https://zenn.dev/tkfoot/articles/claude-code-windows-support

prtksage · 9 months ago

facing this issue, tried downgrading extension and it didnt work

zeng-gq · 9 months ago

同样的问题,看了前面这里面的留言,回滚了版本。1.0.126

miladiashe · 9 months ago

I face this bug too.

gitWK86 · 9 months ago

+1

Hielkez · 9 months ago

Same here. Tried everything to resolve it. No luck.

GoldKingai · 9 months ago
Same here. Tried everything to resolve it. No luck.

what version are you on

vegaalej · 9 months ago

I have the same error, even though I followed all the steps.
"Error: Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). If installed but not in PATH, set environment variable pointing to your bash.exe, similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe"

I have my files in "C:\Users\MyUser\AppData\Local\Programs\Git\bin\bash.exe"

GoldKingai · 9 months ago
I have the same error, even though I followed all the steps. "Error: Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). If installed but not in PATH, set environment variable pointing to your bash.exe, similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe" I have my files in "C:\Users\MyUser\AppData\Local\Programs\Git\bin\bash.exe"

If you had the system working before, the only fix that I find to be working is going back to an earlier version. Try form-like version. 1.0.128 Just try all the versions until you going up to the newest, until you find one that works on your system.

vegaalej · 9 months ago
> I have the same error, even though I followed all the steps. "Error: Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). If installed but not in PATH, set environment variable pointing to your bash.exe, similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe" > I have my files in "C:\Users\MyUser\AppData\Local\Programs\Git\bin\bash.exe" If you had the system working before, the only fix that I find to be working is going back to an earlier version. Try form-like version. 1.0.128 Just try all the versions until you going up to the newest, until you find one that works on your system.

Thanks. But I have not been able to make it work yet :(
Making work this Anthropic version is much harder.
This is why I prefer Codex from OpenAI, no issues there and works perfectly in VSCode IDE.

Aesthermortis · 9 months ago

Uninstalled, it is unusable, and the CLI does not work either. All other AIs work except this one. The desktop application does not work with the file system either. It gives many errors everywhere.

JeffreyBai · 8 months ago

Tried everything but still nothing works. Is there really no solution other than rolling back to an much older version?

YomarFerreira · 8 months ago

I've already given up on using it this way.
Currently, I use it in VsCode's highlighted terminal.
I think that, even with the feature back, I won't use it anymore, as I think it looks even better this way.

erisel · 8 months ago

I had the same problem, but I just found a solution that worked for me. I also got the following error every time I opened the Claude Code extension in VS Code:

Error: Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). If installed but not in PATH, set environment variable pointing to your bash.exe, similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe

SOLUTION (Worked for me on Windows 11, Claude extension version 2.0.25)

This solution relies on Git Bash being correctly available in the system's PATH.

  1. Remove the specific variable: In Windows Environment Variables, find the User variables section and Delete the CLAUDE_CODE_GIT_BASH_PATH variable if it exists.
  2. Add Git CMD to PATH: In the same window, click Edit on the "Path" user variable. Click New and add the path to your Git cmd folder.
  • Path to add: %USERPROFILE%\AppData\Local\Programs\Git\cmd (This is the most common path if installed as a user). If you installed Git globally, it might be C:\Program Files\Git\cmd. Click OK on all windows to save.
  1. Restart VS Code: Close and re-open VS Code completely.
  2. Start the Claude Code-extension. It should now work.

If that does not work, verify your setup:

If the steps above still don't resolve the issue, you likely have other missing paths.

  • Verify Claude is in PATH: Open a new PowerShell terminal and run claude --help. If you get a Setup note saying: "Native installation exists but "C:\Users\YourUserName\.local\bin" is not in your PATH", you must add this path to your Environment Variables Path variable: Path to add: %USERPROFILE%\.local\bin
  • Verify Claude can access files (cygpath error): If you run Claude in the terminal and get an error like: /usr/bin/bash: line 1: cygpath: command not found, the Unix tools are missing from PATH. Add the Git usr\bin folder to your Environment Variables Path variable:
  • Path to add: %USERPROFILE%\AppData\Local\Programs\Git\usr\bin
  • Once these two potential issues are resolved, try the SOLUTION steps (1-4) again.

Hopefully this can help someone else. :)

kongdd · 8 months ago

Any idea how to hide git-bash.exe window? Each time, a black window open and closed

Light-Bobine · 8 months ago

I removed the CLAUDE_CODE_GIT_BASH_PATH variable and make sure that only one variable points to Git (the one in my PATH). Restarted Claude and VS Code, updated Claude Code to its latest version and it works for me now. Thanks @erisel !

ostidepeignecul · 8 months ago

I fixed this issue by correcting my Windows System Variables

I want to share my experience because it might help others who are stuck with this issue.

Background:
I've been using Cursor for a while, working on AI projects with Python and CUDA. I've had occasional issues with Windows registry and Python installations in the past that I never fully understood. When I decided to try Claude Code, I went through the official installation (including Node.js with its additional tools), and the CLI worked fine with cmd. However, when I installed the Claude Code extension in Cursor, it couldn't detect Git Bash - even though I've had Git Bash installed and have been using it regularly for a long time.

What I tried (that didn't work):

  1. Completely uninstalled and reinstalled Git - no success
  2. Uninstalled, reinstalled Node and reinstalled Claude Code from scratch - no success
  3. Followed various suggestions from this thread, added user variables, tried all possible fixes, even downgraded versions - nothing worked
  4. At some point, I gave up and went back to work

The turning point:
While working, I tried to call PowerShell from cmd and it couldn't find the path anymore. Then I tried other basic commands - nothing worked. cmd and powershell calls were completely broken. I initially thought it was Git's fault (since the installer asks about environment variables), so I uninstalled it again - but the problem persisted.

The actual problem:
After digging around in the environment variables, I finally looked at the SYSTEM variable's PATH and discovered the root cause: there was a %PATH% reference in the middle of the system PATH, and the default Windows paths were completely missing!

Original (broken) System PATH:

C:\Python314\Scripts\;C:\Python314\;%PATH%;C:\Program Files\NVIDIA GPU Computing Toolkit\...

This %PATH% in the middle caused recursive expansion issues and prevented Windows from finding any executables.

The fix:

  1. Removed the %PATH% reference from the system PATH
  2. Added back the missing default Windows paths at the beginning
  3. Ensured Git path was included at the end

Corrected System PATH:

C:\Windows\System32\
C:\Windows\
C:\Windows\System32\Wbem\
C:\Windows\System32\WindowsPowerShell\v1.0\
..
C:\Program Files\nodejs\
C:\Program Files\Git\cmd

Result:
After fixing the system PATH, I reopened Cursor (Git was still uninstalled at this point), reinstalled Git with all default settings, and boom - it worked perfectly!

Key takeaway:
If Claude Code can't detect Git Bash on Windows, check your System PATH variable. In my case, I had %PATH% in the middle causing the issue, but fixing this also made me realize that Git's path (C:\Program Files\Git\cmd) needs to be in the system PATH, not the user PATH - at least that's what worked for me. Also verify that default Windows directories (C:\Windows\System32\, etc.) are present at the beginning. Fix the PATH structure first, then reinstall Git with default settings.

This corrupted PATH was likely causing my previous unexplained issues with Python installations and Windows registry as well.

Important note: Most people in this thread talk about modifying the user PATH variable, but in my case, the issue was entirely in the system PATH variable - I didn't add anything to the user PATH at all.

JeffreyBai · 8 months ago
I fixed this issue by correcting my Windows System Variables The fix: 1. Removed the %PATH% reference from the system PATH 2. Added back the missing default Windows paths at the beginning 3. Ensured Git path was included at the end Corrected System PATH: `` C:\Windows\System32\ C:\Windows\ C:\Windows\System32\Wbem\ C:\Windows\System32\WindowsPowerShell\v1.0\ .. C:\Program Files\nodejs\ C:\Program Files\Git\cmd ` **Result:** After fixing the system PATH, I reopened Cursor (Git was still uninstalled at this point), reinstalled Git with all default settings, and **boom - it worked perfectly!** **Key takeaway:** If Claude Code can't detect Git Bash on Windows, check your System PATH variable. In my case, I had %PATH% in the middle causing the issue, but fixing this also made me realize that Git's path (C:\Program Files\Git\cmd) needs to be in the **system PATH**, not the user PATH - at least that's what worked for me. Also verify that default Windows directories (C:\Windows\System32\`, etc.) are present at the beginning. Fix the PATH structure first, then reinstall Git with default settings.
Important note: Most people in this thread talk about modifying the user PATH variable, but in my case, the issue was entirely in the system PATH variable - I didn't add anything to the user PATH at all.

This fix works for me! The critical parts on my side was:

  1. Remove the recursive %PATH%
  2. Add C:\Program Files\Git\cmd to the system path in system variables
  3. Add C:\Windows\System32\ to the beginning of the system path in system variables

Then it worked without even reinstalling Git. It just worked after closing and launching Cursor again.

tazo90 · 8 months ago

Solution for Windows 11 that worked for me (claude v2.0.30):

  1. Add the following line to your ~/.bashrc file:
export CLAUDE_CODE_GIT_BASH_PATH="C:\\Programs\\git-for-windows\\usr\\bin\\bash.exe"
  1. Reload your bash configuration:
source ~/.bashrc
  1. Verify the setup:
claude doctor

Important:

  • Use backslashes \\ in the path
  • Ensure the path points to bash.exe, not just the directory
tildebyte · 8 months ago

I finally got this working.

None of CLAUDE_CODE_GIT_BASH_PATH, SHELL, or anything else made any difference.

The issue is that Windows use the (Windows) where command to find the bash command. If, like me, you screw up your PATH and Windows can't find where... guess what 😬.

Solution:

  • Make CERTAIN that one or both of %SystemRoot%\System32 or %SystemRoot%\SysWOW64 are in the SYSTEM Path (I recommend that because it will apply for all users no matter what). Those are the dirs where where lives.
  • Make CERTAIN that your Git for Windows top-level bin dir is in your USER Path, e.g. for me it's E:\Programs\Git\bin.

There's a bit of nuance here, in that, if where is being found, but one of the other incorrect bashes is being found first, it won't be recognized as the correct Git for Windows bash, ergo - put DRIVE\PATH\Git\bin near the front of your USER Path.

By the way, you DO NOT have to restart Windows, or even log out, but you MUST restart VSCode completely.

RichardScottOZ · 8 months ago
## If that does not work, verify your setup: If the steps above still don't resolve the issue, you likely have other missing paths. Verify Claude is in PATH: Open a new PowerShell terminal and run claude --help. If you get a Setup note saying: "Native installation exists but "C:\Users\YourUserName\.local\bin" is not in your PATH", you must add this path to your Environment Variables Path variable: Path to add: %USERPROFILE%\.local\bin Verify Claude can access files (cygpath error): If you run Claude in the terminal and get an error like: /usr/bin/bash: line 1: cygpath: command not found, the Unix tools are missing from PATH. Add the Git usr\bin folder to your Environment Variables Path variable: Path to add: %USERPROFILE%\AppData\Local\Programs\Git\usr\bin Once these two potential issues are resolved, try the SOLUTION steps (1-4) again. Hopefully this can help someone else. :)

I get the same error 'can't find bash' as previously generically doing anything calling claude from the cli.

lenouar-uae · 7 months ago

I tried most of the above but the only solution that made it work again straight away is adding C:\Windows\System32\ to the system PATH.

Dylson14 · 7 months ago
I had the same problem, but I just found a solution that worked for me. I also got the following error every time I opened the Claude Code extension in VS Code: Error: Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). If installed but not in PATH, set environment variable pointing to your bash.exe, similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe ## SOLUTION (Worked for me on Windows 11, Claude extension version 2.0.25) This solution relies on Git Bash being correctly available in the system's PATH. 1. Remove the specific variable: In Windows Environment Variables, find the User variables section and Delete the CLAUDE_CODE_GIT_BASH_PATH variable if it exists. 2. Add Git CMD to PATH: In the same window, click Edit on the "Path" user variable. Click New and add the path to your Git cmd folder. Path to add: %USERPROFILE%\AppData\Local\Programs\Git\cmd (This is the most common path if installed as a user). If you installed Git globally, it might be C:\Program Files\Git\cmd. Click OK on all windows to save. 3. Restart VS Code: Close and re-open VS Code completely. 4. Start the Claude Code-extension. It should now work. ## If that does not work, verify your setup: If the steps above still don't resolve the issue, you likely have other missing paths. Verify Claude is in PATH: Open a new PowerShell terminal and run claude --help. If you get a Setup note saying: "Native installation exists but "C:\Users\YourUserName\.local\bin" is not in your PATH", you must add this path to your Environment Variables Path variable: Path to add: %USERPROFILE%\.local\bin Verify Claude can access files (cygpath error): If you run Claude in the terminal and get an error like: /usr/bin/bash: line 1: cygpath: command not found, the Unix tools are missing from PATH. Add the Git usr\bin folder to your Environment Variables Path variable: Path to add: %USERPROFILE%\AppData\Local\Programs\Git\usr\bin * Once these two potential issues are resolved, try the SOLUTION steps (1-4) again. Hopefully this can help someone else. :)
I had the same problem, but I just found a solution that worked for me. I also got the following error every time I opened the Claude Code extension in VS Code: Error: Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). If installed but not in PATH, set environment variable pointing to your bash.exe, similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe ## SOLUTION (Worked for me on Windows 11, Claude extension version 2.0.25) This solution relies on Git Bash being correctly available in the system's PATH. 1. Remove the specific variable: In Windows Environment Variables, find the User variables section and Delete the CLAUDE_CODE_GIT_BASH_PATH variable if it exists. 2. Add Git CMD to PATH: In the same window, click Edit on the "Path" user variable. Click New and add the path to your Git cmd folder. Path to add: %USERPROFILE%\AppData\Local\Programs\Git\cmd (This is the most common path if installed as a user). If you installed Git globally, it might be C:\Program Files\Git\cmd. Click OK on all windows to save. 3. Restart VS Code: Close and re-open VS Code completely. 4. Start the Claude Code-extension. It should now work. ## If that does not work, verify your setup: If the steps above still don't resolve the issue, you likely have other missing paths. Verify Claude is in PATH: Open a new PowerShell terminal and run claude --help. If you get a Setup note saying: "Native installation exists but "C:\Users\YourUserName\.local\bin" is not in your PATH", you must add this path to your Environment Variables Path variable: Path to add: %USERPROFILE%\.local\bin Verify Claude can access files (cygpath error): If you run Claude in the terminal and get an error like: /usr/bin/bash: line 1: cygpath: command not found, the Unix tools are missing from PATH. Add the Git usr\bin folder to your Environment Variables Path variable: Path to add: %USERPROFILE%\AppData\Local\Programs\Git\usr\bin * Once these two potential issues are resolved, try the SOLUTION steps (1-4) again. Hopefully this can help someone else. :)

THIS SOLUTION WORKED FOR ME! ✅

luyao · 7 months ago

Just for me, on Windows11 start claude in Powershell works but gitbash failed, hope it helps.

saivx · 7 months ago
I had the same problem, but I just found a solution that worked for me. I also got the following error every time I opened the Claude Code extension in VS Code: Error: Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). If installed but not in PATH, set environment variable pointing to your bash.exe, similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe ## SOLUTION (Worked for me on Windows 11, Claude extension version 2.0.25) This solution relies on Git Bash being correctly available in the system's PATH. 1. Remove the specific variable: In Windows Environment Variables, find the User variables section and Delete the CLAUDE_CODE_GIT_BASH_PATH variable if it exists. 2. Add Git CMD to PATH: In the same window, click Edit on the "Path" user variable. Click New and add the path to your Git cmd folder. Path to add: %USERPROFILE%\AppData\Local\Programs\Git\cmd (This is the most common path if installed as a user). If you installed Git globally, it might be C:\Program Files\Git\cmd. Click OK on all windows to save. 3. Restart VS Code: Close and re-open VS Code completely. 4. Start the Claude Code-extension. It should now work. ## If that does not work, verify your setup: If the steps above still don't resolve the issue, you likely have other missing paths. Verify Claude is in PATH: Open a new PowerShell terminal and run claude --help. If you get a Setup note saying: "Native installation exists but "C:\Users\YourUserName\.local\bin" is not in your PATH", you must add this path to your Environment Variables Path variable: Path to add: %USERPROFILE%\.local\bin Verify Claude can access files (cygpath error): If you run Claude in the terminal and get an error like: /usr/bin/bash: line 1: cygpath: command not found, the Unix tools are missing from PATH. Add the Git usr\bin folder to your Environment Variables Path variable: Path to add: %USERPROFILE%\AppData\Local\Programs\Git\usr\bin * Once these two potential issues are resolved, try the SOLUTION steps (1-4) again. Hopefully this can help someone else. :)

Had same problem. This method worked. The biggest issue i think is pointing to the "bin" folder instead of the "cmd" folder on windows portable git. Thanks

GoldKingai · 7 months ago

Claude Code Git Bash Detection Fix for Windows - Complete Troubleshooting Guide

Problem Description

When attempting to use the Claude Code extension in VS Code or Cursor on Windows, users encounter the following error:

Error: Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). 
If installed but not in PATH, set environment variable pointing to your bash.exe, 
similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe

This error persists even when:

  • Git Bash is properly installed
  • Git is in the system PATH
  • The CLAUDE_CODE_GIT_BASH_PATH environment variable is correctly set
  • Running bash --version in terminal works fine

Root Cause

The issue is NOT a bug in the Claude Code extension itself (in most cases). The actual problem is:

Running applications do not automatically inherit updated environment variables. When you set environment variables or modify PATH, applications that are already running (including VS Code, Cursor, Windows Explorer, and background processes) continue using their old environment. Simply closing and reopening the application is often insufficient because:

  1. Background processes may still be running
  2. The Windows Explorer shell (which launches applications) hasn't reloaded environment variables
  3. Some applications cache environment variables at startup

The Solution: Complete System Restart

TL;DR - Quick Fix

  1. Install Git for Windows (if not already installed)
  2. Set environment variables properly
  3. Restart your entire computer (not just the application)
  4. Launch VS Code/Cursor fresh from Start Menu
  5. Try Claude Code extension

Detailed Step-by-Step Solution

---

Step 1: Verify Git Installation

First, check if Git is actually installed:

In PowerShell:

# Check if bash exists
Test-Path "C:\Program Files\Git\bin\bash.exe"

Expected result: True

If it returns False, you need to install Git:

  1. Download Git for Windows: https://git-scm.com/downloads/win
  2. During installation, select "Git from the command line and also from 3rd-party software"
  3. Complete the installation with default settings
  4. Restart your computer after installation

---

Step 2: Set Environment Variables (User Level)

Even if Git is installed, you need to set the environment variable that Claude Code looks for.

Method 1: Using PowerShell (Recommended)

Open PowerShell and run:

# Set the Git Bash path environment variable
[System.Environment]::SetEnvironmentVariable('CLAUDE_CODE_GIT_BASH_PATH', 'C:\Program Files\Git\bin\bash.exe', 'User')

# Verify it was set
[System.Environment]::GetEnvironmentVariable('CLAUDE_CODE_GIT_BASH_PATH', 'User')

Method 2: Using Windows GUI

  1. Search for "Environment Variables" in Windows Start Menu
  2. Click "Edit environment variables for your account"
  3. Under "User variables", click "New..."
  4. Variable name: CLAUDE_CODE_GIT_BASH_PATH
  5. Variable value: C:\Program Files\Git\bin\bash.exe
  6. Click OK

---

Step 3: Add Git to System PATH

Ensure Git's bin directory is in your PATH:

In PowerShell (as Administrator):

# Get current user PATH
$currentPath = [System.Environment]::GetEnvironmentVariable('Path', 'User')

# Check if Git is already in PATH
if ($currentPath -notlike "*Git\bin*") {
    # Add Git to PATH
    $newPath = $currentPath + ";C:\Program Files\Git\bin;C:\Program Files\Git\cmd"
    [System.Environment]::SetEnvironmentVariable('Path', $newPath, 'User')
    Write-Host "Git added to PATH successfully"
} else {
    Write-Host "Git is already in PATH"
}

Alternative: GUI Method

  1. Search for "Environment Variables" in Windows Start
  2. Click "Edit the system environment variables"
  3. Click "Environment Variables..." button
  4. Under "User variables", find and select "Path"
  5. Click "Edit..."
  6. Click "New"
  7. Add: C:\Program Files\Git\bin
  8. Add another: C:\Program Files\Git\cmd
  9. Click OK on all windows

---

Step 4: THE CRITICAL STEP - Full System Restart

This is the most important step that most troubleshooting guides miss.

Why a full restart is necessary:

  • Closing and reopening VS Code/Cursor is NOT enough
  • Using "Reload Window" in VS Code is NOT enough
  • Closing all applications is NOT enough

You MUST restart your entire computer for the following reasons:

  1. Windows Explorer (which launches applications from Start Menu/Desktop) needs to reload environment variables
  2. Background processes from VS Code, Cursor, or other applications may still be running with old environment
  3. System services need to pick up new PATH settings
  4. Parent process inheritance - applications inherit environment from their launching process, which needs to have the updated variables

How to restart properly:

  1. Close ALL applications (VS Code, Cursor, terminals, everything)
  2. Check Task Manager (Ctrl + Shift + Esc):
  • Look for any Code.exe, Cursor.exe, or node.exe processes
  • End any lingering processes
  1. Restart Windows:
  • Start Menu → Power → Restart
  • NOT just Sleep or Log Off - must be a full restart

---

Step 5: Verify Configuration After Restart

After your computer restarts, open a NEW PowerShell window and verify:

# Test 1: Check if bash is in PATH
where.exe bash
# Expected output: C:\Program Files\Git\bin\bash.exe

# Test 2: Check environment variable
$env:CLAUDE_CODE_GIT_BASH_PATH
# Expected output: C:\Program Files\Git\bin\bash.exe

# Test 3: Verify bash works
bash --version
# Expected output: GNU bash, version 5.2.x

All three tests must pass before proceeding.

---

Step 6: Launch VS Code/Cursor Properly

IMPORTANT: Launch fresh from Start Menu, not from:

  • Pinned taskbar icons (they may cache old environment)
  • Recent files list
  • Right-click "Open with Code" in File Explorer

Correct way to launch:

  1. Click Windows Start Menu
  2. Search for "Visual Studio Code" or "Cursor"
  3. Click to launch
  4. Open your project folder
  5. Try Claude Code extension

---

Step 7: Test Claude Code Extension

  1. Open the Claude Code panel in VS Code/Cursor
  2. Try starting a new conversation
  3. If it works - you're done!
  4. If you still get the error, proceed to Advanced Troubleshooting below

---

Advanced Troubleshooting

Issue: Still not working after restart

If you've followed all steps above and it still doesn't work:

Check VS Code's Terminal Integration

Add this to VS Code's settings.json:

{
  "terminal.integrated.env.windows": {
    "CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe",
    "PATH": "${env:PATH};C:\\Program Files\\Git\\bin"
  },
  "terminal.integrated.defaultProfile.windows": "Git Bash"
}

Then restart VS Code from Start Menu (not using "Reload Window").

Try System-Level Environment Variables

If user-level variables don't work, set them at system level:

In PowerShell (Run as Administrator):

[System.Environment]::SetEnvironmentVariable('CLAUDE_CODE_GIT_BASH_PATH', 'C:\Program Files\Git\bin\bash.exe', 'Machine')

Then restart your computer again.

Create Symbolic Link (Path Space Issue Workaround)

Some versions may have issues with spaces in "Program Files":

In Git Bash (Run as Administrator):

ln -s "/c/Program Files/Git" /c/Git

Then update your environment variable:

[System.Environment]::SetEnvironmentVariable('CLAUDE_CODE_GIT_BASH_PATH', 'C:\Git\bin\bash.exe', 'User')

Restart computer and test again.

---

Alternative Solution: Use Claude Code CLI

If the VS Code/Cursor extension continues to have issues, you can use the standalone CLI:

Install Claude Code CLI

In PowerShell:

npm install -g @anthropic-ai/claude-code

Or download directly from: https://claude.ai/download

Add CLI to PATH

# Get current user PATH
$currentPath = [System.Environment]::GetEnvironmentVariable('Path', 'User')

# Add Claude Code to PATH
$newPath = $currentPath + ";C:\Users\$env:USERNAME\.local\bin"
[System.Environment]::SetEnvironmentVariable('Path', $newPath, 'User')

Use Claude Code from Terminal

After restarting your computer:

In Git Bash:

cd "/d/Your/Project/Path"
claude

In PowerShell:

cd "D:\Your\Project\Path"
claude

---

Common Mistakes That Won't Work

❌ Things that DON'T fix the issue:

  1. Just closing and reopening VS Code/Cursor - Not enough, need full restart
  2. Using "Developer: Reload Window" - Doesn't reload environment variables
  3. Uninstalling and reinstalling the extension - Environment is the issue, not the extension
  4. Setting variables in VS Code settings only - Extensions read system environment
  5. Using relative paths or forward slashes - Must use Windows-style absolute paths with backslashes
  6. Setting PATH in terminal only - Needs to be in Windows environment variables

✅ What actually works:

  1. Proper environment variable configuration at Windows system level
  2. Full computer restart to reload all processes
  3. Fresh application launch from Start Menu after restart
  4. Patience - Don't skip the restart step!

---

Verification Checklist

Before reporting that "it still doesn't work", verify you've done ALL of these:

  • [x] Git for Windows is installed at C:\Program Files\Git\bin\bash.exe
  • [ ] CLAUDE_CODE_GIT_BASH_PATH environment variable is set (User or System level)
  • [x] Git is in your PATH (where.exe bash returns the path)
  • [ ] You have restarted your entire computer (not just applications)
  • [ ] You opened a new PowerShell AFTER restart and verified environment variables
  • [ ] You launched VS Code/Cursor from Start Menu (not from taskbar or file explorer)
  • [ ] You killed any lingering processes in Task Manager before restart

---

Known Issues and Limitations

Reported GitHub Issues

This problem has been reported in multiple GitHub issues:

Why This Happens

The Claude Code extension must spawn a bash subprocess to function. On Windows, this requires:

  1. Finding bash.exe in the system
  2. Having proper permissions to execute it
  3. Having a valid Unix-like environment for the subprocess

The extension checks for bash in this order:

  1. CLAUDE_CODE_GIT_BASH_PATH environment variable
  2. System PATH for bash or bash.exe
  3. Common Git installation locations

If the extension's parent process has stale environment variables (because it was started before you set them), it will fail all three checks even though bash is properly configured.

---

Success Indicators

You'll know it's working when:

  1. ✅ Claude Code panel opens without errors
  2. ✅ You can start a new conversation
  3. ✅ Claude can read and modify files in your project
  4. ✅ No "requires git-bash" error appears in the output logs

---

Additional Resources

---

Contributing to This Guide

If you've found additional solutions or have corrections, please contribute by:

  1. Testing the solutions on your Windows system
  2. Documenting what worked/didn't work
  3. Sharing version information (Windows version, Git version, Claude Code version)
  4. Opening issues on the Claude Code GitHub repository

---

Summary: The Real Fix

99% of "Git Bash not detected" issues on Windows are solved by:

  1. Setting CLAUDE_CODE_GIT_BASH_PATH environment variable
  2. Adding Git to PATH
  3. RESTARTING YOUR ENTIRE COMPUTER
  4. Launching VS Code/Cursor fresh from Start Menu

The restart is not optional. It's the critical step that reloads environment variables across all processes. Don't skip it!

---

Tested Configurations

This guide has been verified to work on:

  • ✅ Windows 10 (64-bit)
  • ✅ Windows 11 (64-bit)
  • ✅ Git for Windows 2.40+
  • ✅ VS Code with Claude Code extension v2.0.62+
  • ✅ Cursor with Claude Code extension

---

Last Resort: Report Your Issue

If you've tried everything in this guide including the full restart and it still doesn't work:

  1. Collect diagnostic information:

``powershell
# Run these in PowerShell and save output
git --version
bash --version
where.exe bash
$env:CLAUDE_CODE_GIT_BASH_PATH
$env:PATH -split ';' | Select-String -Pattern 'Git'
``

  1. Check VS Code output logs:
  • Open VS Code
  • Press Ctrl + Shift + U (Output panel)
  • Select "Claude Code" from dropdown
  • Copy the logs
  1. Report on GitHub:

---

Remember: The restart is not optional. It's the solution.

Good luck! 🚀

asyamirzaoglu · 6 months ago

✅ SOLUTION for Windows 11 Pro

Step 1: Reinstall Git to C:\Git

  • Uninstall Git from C:\Program Files\Git
  • Reinstall to C:\Git (no spaces in path)

Step 2: Delete CLAUDE_CODE_GIT_BASH_PATH variable

  • Remove from both User and System variables

Step 3: Add these to System PATH (at the top)

System variables → Path → Edit → Add these:

C:\Git\bin
C:\Git\cmd
C:\Windows\System32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0

Step 4: Restart PC

Step 5: Verify

where.exe bash

Should show: C:\Git\bin\bash.exe

Done! Claude Code extension works now.

JeffreyBai · 6 months ago
# Claude Code Git Bash Detection Fix for Windows - Complete Troubleshooting Guide

​Thank you for the detailed steps, but from a paid user's perspective, this still feels like a very hacky workaround.
​For a premium service, this tool should work directly out of the box and handle underlying mechanisms (like path detection) automatically. We shouldn't be facing such critical blocking issues that require complex troubleshooting just to get the basic functionality working. This is not the level of quality we expect from a paid service.

ulfkri · 5 months ago

Having the same issue. It works for me if i run vs code in an elevated process (run vs code as admin). I don't want agents running with elevated privileges on my machine, but it might be a hint to devs as to what is wrong.

I'm on claude code extension version 2.1.15, vs code version 1.108.1 running on win 11.

whynottesting · 5 months ago

Hi there, thank you very much for your detailed explanation @GoldKingai
I solved the first issue and don't get anymore the error on VS Code.

Error: Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). 
If installed but not in PATH, set environment variable pointing to your bash.exe, 
similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe

Now I get another error

claude : The term 'claude' 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.
At line:1 char:1

claude
  + CategoryInfo          : ObjectNotFound: (claude:String) [], CommandNotFoundException
  + FullyQualifiedErrorId : CommandNotFoundException

Can you please help?
Or someone else ?

Zen-ctrl · 5 months ago

this works! thanks

Kimonarrow · 5 months ago

I had done everything, mentioned above and still it wouldn't work, the solution after trying all the previous steps that fixed it for me (Windows 10 native [no WSL]) was to add C:\Windows\System32\ to PATH (user vars)

pjornrachzark · 5 months ago
## I had done everything, mentioned above and still it wouldn't work, the solution after trying all the previous steps that fixed it for me (Windows 10 native [no WSL]) was to add C:\Windows\System32\ to PATH (user vars)

Worked perfectly for me! Win11
For anyone else who doesn't have time for doing it manually, just run this via powershell:

$currentPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
[System.Environment]::SetEnvironmentVariable("Path", "$currentPath;C:\Windows\System32\", "User")
b0hd4n · 4 months ago

Fixed for me: native installation, v2.1.47, Windows 10, WSL installed

If you do have the WSL, C:\Windows\System32\bash.exe could actually point to WLS instead of git-bash.
In such a case, make sure C:\Program Files\Git\bin\ appears first in the system Path variable, so that when you test where bash.exe you see:

C:\Users\username> where bash.exe
C:\Program Files\Git\bin\bash.exe
C:\Windows\System32\bash.exe

You see that git-bash appears as the first option (or the only option).

mpurnell1 · 4 months ago

Not sure who will still be following this issue almost a year and a half later, but I think I may have found another workaround for this issue for anyone who might not have bash.exe in their System32 folder.

  1. Open a Windows Explorer window and navigate to your user directory, then find the .claude folder (you might need to show hidden files and folders) and open the downloads folder within. Keep this window open.
  2. Open another Windows Explorer window and navigate to the location you would like to install and run claude. Keep this window open.
  3. Run the script found at https://code.claude.com/docs/en/quickstart (irm https://claude.ai/install.ps1 | iex)
  4. You should notice a file appears (named something like claude-2.1.58-win32-x64.exe) in the downloads folder, then disappears.
  5. This may take a few tries, but your goal is to copy the file from the .claude/downloads folder into the target folder in the small window that it exists after being fetched but before being cleaned up.

a. Repeat these steps: Start the script in a powershell window, wait for the .exe to appear in .claude/downloads, click it, press Ctrl+C, click an empty area in the other Explorer window, press Ctrl+V
b. You might get an error saying the file is in use, that's fine: click try again.
c. You might get an error saying the file no longer exists, that's fine: start the script again, then try copying it again.

  1. If you are successful at copying the file out of the .claude/downloads folder, then the file will be preserved after the install script fails instead of being automatically cleaned up.
  2. If git is correctly installed, you should be able to just run this executable and a claude window should pop up asking you to choose a theme and taking you through the rest of the setup.
  3. An optional final step is to rename the file to claude.exe, copy it to C:\Users\\\<username\>\\.local\bin, and add that folder to your path

a. To edit your PATH, press Win+R, then enter rundll32 sysdm.cpl,EditEnvironmentVariables and click OK
b. Select the variable named Path, click Edit, then in the window that opens, click New, enter the .local/bin folder that you put claude.exe into, then click OK to finish editing path, and OK again to close the Environment Variables window.
c. After you have done this, press Win+R and enter powershell, and click OK, then cd to the directory where you want to run claude from. Since it is in your path now, you should just be able to run claude

mohamed06H · 4 months ago

I resolved this problem on my environnement Windows + VScode by setting this conf in ~/.claude/settings.json:

{
"env": {
"CLAUDE_CODE_GIT_BASH_PATH": "C:\\Users\\<USERNAME>\\AppData\\Local\\Programs\\Git\\usr\\bin\\bash.exe"
}
}

PatFox · 4 months ago
## I had done everything, mentioned above and still it wouldn't work, the solution after trying all the previous steps that fixed it for me (Windows 10 native [no WSL]) was to add C:\Windows\System32\ to PATH (user vars)

This (eventually) led me to the answer that fixed it for me: I already had C:\Windows\System32\ in my path, as well as the Git bash path, but it didn't work.

BUT when I moved System32 to the top, and Git bash directly after, it worked. So you need to have System32 before Git, and Git before anything else that might be picked up when looking for 'bash.exe'.

I don't know whether this will break anything else, but it fixed this particular issue.

theirongiant · 4 months ago
> ## I had done everything, mentioned above and still it wouldn't work, the solution after trying all the previous steps that fixed it for me (Windows 10 native [no WSL]) was to add C:\Windows\System32\ to PATH (user vars) This (eventually) led me to the answer that fixed it for me: I already had C:\Windows\System32\ in my path, as well as the Git bash path, but it didn't work. BUT when I moved System32 to the top, and Git bash directly after, it worked. So you need to have System32 before Git, and Git before anything else that might be picked up when looking for 'bash.exe'. I don't know whether this will break anything else, but it fixed this particular issue.

Can confirm this worked for me, I didn't have the git bin folder in my path at all but (probably due to the fact that I get git-for-windows via cmder) once I added it and moved system32 and git bin to the first and second entries in path claude no longer shows the error.

AGurel · 4 months ago

Update v2:
Adding C:\Windows\System32\ to the system PATH has resolved my issue. Both the CLI and VSCode extension work as intended.

This worked for me.

20Bolin · 4 months ago

On my Win11(no WSL), I encountered exactly the same problem while installing with PowerShell. I tried to add "C:\Windows\System32\" to the system PATH, but it didn't work. However, when I installed it with cmd, it prompted me that I should add "C:\User\my_username\.local\bin" to the user variable. I did it and Claude worked.

wt0215 · 4 months ago

参照上面的方法,发现还是不行,几乎试遍了网络上关于环境变量设置的方法,都行不通。
关键发现,PowerShell 中无法获得 git,但是在 CMD 终端中可以获得。
原因:
Ran terminal command: Get-Command git.exe -All; Get-Command "D:\program\Git\cmd\git.exe"; $env:PATHEXT
原因找到了:PowerShell 里的 PATHEXT 只有 .CPL,没有 .EXE,所以 git 这样的可执行文件不会被当作命令解析(git.exe 能找到就是这个原因)。
临时修复(当前 PowerShell 会话内生效):
$env:PATHEXT = ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL"
永久修复(写入用户环境变量,重启 VS Code 生效):
[Environment]::SetEnvironmentVariable(
"PATHEXT",
".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL",
"User"
)

使用这个方法设置后VS Code可以正常使用Claude插件了

Gobliins · 4 months ago

C:\Windows\System32\ to PATH (user vars) fixed it for me

iainiRX · 4 months ago

succeed:

Fix: Claude Code on Windows requires Git Bash (bash.exe) in VS Code (Traditional)

Conclusion

Claude Code on Windows needs Git for Windows’ Git Bash (bash.exe). If the VS Code plugin can’t find it, the most reliable fix is:
1) Confirm bash.exe exists
2) Set environment variable CLAUDE_CODE_GIT_BASH_PATH to the full path of bash.exe
3) Fully restart VS Code (kill all Code.exe processes)

Note: After setting a User environment variable, the current PowerShell session won’t auto-refresh, so echo $env:... can be empty and that’s normal.

Break it down into small steps

1) Confirm where bash.exe is

Common Git for Windows locations (both may exist):

  • C:\Program Files\Git\bin\bash.exe
  • C:\Program Files\Git\usr\bin\bash.exe

Check with PowerShell:

Test-Path "C:\Program Files\Git\bin\bash.exe"
Test-Path "C:\Program Files\Git\usr\bin\bash.exe"
iainiRX · 4 months ago

[Environment]::SetEnvironmentVariable(
"CLAUDE_CODE_GIT_BASH_PATH",
"C:\Program Files\Git\bin\bash.exe",
"User"
)

iainiRX · 4 months ago

[Environment]::GetEnvironmentVariable("CLAUDE_CODE_GIT_BASH_PATH","User")

iainiRX · 4 months ago

$env:CLAUDE_CODE_GIT_BASH_PATH = [Environment]::GetEnvironmentVariable("CLAUDE_CODE_GIT_BASH_PATH","User")
echo $env:CLAUDE_CODE_GIT_BASH_PATH

iainiRX · 4 months ago

[Environment]::SetEnvironmentVariable(
"CLAUDE_CODE_GIT_BASH_PATH",
"C:\Program Files\Git\bin\bash.exe",
"Machine"
)

abdessalem0S · 4 months ago

Worked for me

Set the env variable — Add to system environment variables:

CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe

Add to your system PATH :

C:\Windows\System32\
C:\Program Files\Git\bin
C:\Program Files\Git\cmd

Then restart VS Code.

onurhanulku · 4 months ago
Worked for me Set the env variable — Add to system environment variables: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe Add to your system PATH : C:\Windows\System32 C:\Program Files\Git\bin C:\Program Files\Git\cmd Then restart VS Code.

This is worked for me thx.

PiusLucky · 3 months ago
Worked for me Set the env variable — Add to system environment variables: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe Add to your system PATH : C:\Windows\System32 C:\Program Files\Git\bin C:\Program Files\Git\cmd Then restart VS Code.

Thank you. Worked 100%

vtlinh · 3 months ago
Worked for me Set the env variable — Add to system environment variables: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe Add to your system PATH : C:\Windows\System32 C:\Program Files\Git\bin C:\Program Files\Git\cmd Then restart VS Code.

This did not work for me, but creating/modifying the ~/.claude/settings.json file worked:

{
  "env": {
    "CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe"
  }
}
huangkunkun · 3 months ago
Worked for me  对我来说很管用 Set the env variable — Add to system environment variables:设置环境变量 — 向系统添加环境变量: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exeCLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe Add to your system PATH :向你的系统添加 PATH: C:\Windows\System32  C:\Windows\System32 C:\Program Files\Git\binC:\Program Files\Git\bin C:\Program Files\Git\cmdC:\Program Files\Git\cmd Then restart VS Code.  然后重启 VS Code。

Thank you , this is worked for me

maixiangyu666 · 3 months ago
Worked for me Set the env variable — Add to system environment variables: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe Add to your system PATH : C:\Windows\System32 C:\Program Files\Git\bin C:\Program Files\Git\cmd Then restart VS Code.

thank you for your response . 100% worked

yurukusa · 3 months ago

The VS Code extension has trouble detecting Git Bash because it looks for specific shell paths. Here are fixes:
Workaround 1 — Set VS Code's default terminal to Git Bash:
In VS Code settings (settings.json):

{
  "terminal.integrated.defaultProfile.windows": "Git Bash",
  "terminal.integrated.profiles.windows": {
    "Git Bash": {
      "path": "C:\\Program Files\\Git\\bin\\bash.exe",
      "args": ["--login", "-i"]
    }
  }
}

Workaround 2 — Use the SHELL environment variable:
Set the shell explicitly before launching:

set SHELL=C:\Program Files\Git\bin\bash.exe

Or in your system environment variables permanently.
Workaround 3 — Run Claude Code in Git Bash terminal directly:
Instead of using the extension's Native UI:

  1. Open VS Code's terminal (Ctrl+``)
  2. Select "Git Bash" from the terminal dropdown
  3. Run claude

This uses the CLI directly in Git Bash, bypassing the extension's shell detection.
Workaround 4 — Use WSL instead of Git Bash:
WSL (Windows Subsystem for Linux) is a more robustly supported environment for Claude Code on Windows:

wsl --install

WSL is detected correctly by both the CLI and the extension.

neoKushan · 3 months ago

Just to add to this, check that git has actually installed the binaries to your program files. If you run the git installer as a non-admin, it'll install binaries to your user folder instead. Reinstalling git without first uninstalling it won't change that ,you need to uninstall git and then run the installer as administrator so that it has permissions to install the binaries to Program Files.

Check C:\Program Files\Git exists and inside there's a bin folder and inside that exists bash.exe.

lbertolla-1hmx · 3 months ago

Still happening on April 2026 with Claude Code v2.1.97,
Git installed at default path C:\Program Files\Git,
bash.exe verified present, C:\Program Files\Git\bin in Machine PATH.
Terminal workaround works fine.

github-actions[bot] · 3 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.