[BUG]Claude Code VS Code Extension Fails to Detect Git Bash on Windows Despite Correct Configuration
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:
- Git Bash being properly installed and functional
- Correct environment variable configuration
- Bash executable being accessible and working
- Multiple troubleshooting attempts including path modifications
Steps to Reproduce
- Install Git for Windows with Git Bash
- Install Claude Code VS Code extension (version 2.0.2)
- Verify Git Bash works:
& "C:\Program Files\Git\bin\bash.exe" --version - Set environment variable:
$env:CLAUDE_CODE_GIT_BASH_PATH = "C:\Program Files\Git\bin\bash.exe" - Attempt to use Claude Code extension in VS Code
- 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.exeand space-free symbolic linkC:\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\binto system PATH - Added
C:\Program Files\Git\cmdto system PATH - Verified
git --versionworks (showing PATH is functional) - Created symbolic link without spaces:
C:\GitBash→C:\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:
- Proper handling of paths with spaces (Program Files)
- Reliable environment variable detection
- 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_
68 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
I have the same error
Same issue here.
I checked my environment variables, and there were quite a few no longer present.
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:
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.Same error here! 😢
Same here. Now i'm only using Claude Code in my terminal because I can't use the extension from Visual Studio Code
@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
Same issue! Fix it, Claude!
Same issue here. The older extension version works for me, thanks to @GoldKingai for his workaround.
Same issue! Fix it, Claude!
I had the same error for last 3 days.
I reverted to version 1.0.117 and it worked
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
Fixed following this guide https://zenn.dev/tkfoot/articles/claude-code-windows-support
facing this issue, tried downgrading extension and it didnt work
同样的问题,看了前面这里面的留言,回滚了版本。1.0.126
I face this bug too.
+1
Same here. Tried everything to resolve it. No luck.
what version are you on
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.
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.
Tried everything but still nothing works. Is there really no solution other than rolling back to an much older version?
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.
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.exeSOLUTION (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.
CLAUDE_CODE_GIT_BASH_PATHvariable if it exists.cmdfolder.%USERPROFILE%\AppData\Local\Programs\Git\cmd(This is the most common path if installed as a user). If you installed Git globally, it might beC:\Program Files\Git\cmd. Click OK on all windows to save.If that does not work, verify your setup:
If the steps above still don't resolve the issue, you likely have other missing paths.
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\bincygpatherror): 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 Gitusr\binfolder to your Environment Variables Path variable:%USERPROFILE%\AppData\Local\Programs\Git\usr\binHopefully this can help someone else. :)
Any idea how to hide git-bash.exe window? Each time, a black window open and closed
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 !
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):
The turning point:
While working, I tried to call PowerShell from
cmdand it couldn't find the path anymore. Then I tried other basic commands - nothing worked.cmdandpowershellcalls 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:
This
%PATH%in the middle caused recursive expansion issues and prevented Windows from finding any executables.The fix:
%PATH%reference from the system PATHCorrected System PATH:
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.
This fix works for me! The critical parts on my side was:
Then it worked without even reinstalling Git. It just worked after closing and launching Cursor again.
Solution for Windows 11 that worked for me (claude v2.0.30):
~/.bashrcfile:Important:
\\in the pathbash.exe, not just the directoryI 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)
wherecommand to find thebashcommand. If, like me, you screw up your PATH and Windows can't findwhere... guess what 😬.Solution:
%SystemRoot%\System32or%SystemRoot%\SysWOW64are in the SYSTEM Path (I recommend that because it will apply for all users no matter what). Those are the dirs wherewherelives.bindir is in your USER Path, e.g. for me it'sE:\Programs\Git\bin.There's a bit of nuance here, in that, if
whereis 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 - putDRIVE\PATH\Git\binnear 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.
I get the same error 'can't find bash' as previously generically doing anything calling claude from the cli.
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.
THIS SOLUTION WORKED FOR ME! ✅
Just for me, on Windows11 start claude in Powershell works but gitbash failed, hope it helps.
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
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:
This error persists even when:
CLAUDE_CODE_GIT_BASH_PATHenvironment variable is correctly setbash --versionin terminal works fineRoot 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:
The Solution: Complete System Restart
TL;DR - Quick Fix
Detailed Step-by-Step Solution
---
Step 1: Verify Git Installation
First, check if Git is actually installed:
In PowerShell:
Expected result:
TrueIf it returns
False, you need to install Git:---
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:
Method 2: Using Windows GUI
CLAUDE_CODE_GIT_BASH_PATHC:\Program Files\Git\bin\bash.exe---
Step 3: Add Git to System PATH
Ensure Git's bin directory is in your PATH:
In PowerShell (as Administrator):
Alternative: GUI Method
C:\Program Files\Git\binC:\Program Files\Git\cmd---
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:
You MUST restart your entire computer for the following reasons:
How to restart properly:
Ctrl + Shift + Esc):Code.exe,Cursor.exe, ornode.exeprocesses---
Step 5: Verify Configuration After Restart
After your computer restarts, open a NEW PowerShell window and verify:
All three tests must pass before proceeding.
---
Step 6: Launch VS Code/Cursor Properly
IMPORTANT: Launch fresh from Start Menu, not from:
Correct way to launch:
---
Step 7: Test Claude Code Extension
---
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: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):
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):
Then update your environment variable:
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:
Or download directly from: https://claude.ai/download
Add CLI to PATH
Use Claude Code from Terminal
After restarting your computer:
In Git Bash:
In PowerShell:
---
Common Mistakes That Won't Work
❌ Things that DON'T fix the issue:
✅ What actually works:
---
Verification Checklist
Before reporting that "it still doesn't work", verify you've done ALL of these:
C:\Program Files\Git\bin\bash.exeCLAUDE_CODE_GIT_BASH_PATHenvironment variable is set (User or System level)where.exe bashreturns the path)---
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:
bash.exein the systemThe extension checks for bash in this order:
CLAUDE_CODE_GIT_BASH_PATHenvironment variablebashorbash.exeIf 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:
---
Additional Resources
---
Contributing to This Guide
If you've found additional solutions or have corrections, please contribute by:
---
Summary: The Real Fix
99% of "Git Bash not detected" issues on Windows are solved by:
CLAUDE_CODE_GIT_BASH_PATHenvironment variableThe 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:
---
Last Resort: Report Your Issue
If you've tried everything in this guide including the full restart and it still doesn't work:
``
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'
Ctrl + Shift + U(Output panel)---
Remember: The restart is not optional. It's the solution.
Good luck! 🚀
✅ SOLUTION for Windows 11 Pro
Step 1: Reinstall Git to C:\Git
C:\Program Files\GitC:\Git(no spaces in path)Step 2: Delete CLAUDE_CODE_GIT_BASH_PATH variable
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
Should show:
C:\Git\bin\bash.exeDone! Claude Code extension works now.
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.
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.
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.
Now I get another error
Can you please help?
Or someone else ?
this works! thanks
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:
Fixed for me: native installation, v2.1.47, Windows 10, WSL installed
If you do have the WSL,
C:\Windows\System32\bash.execould 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 testwhere bash.exeyou see:You see that git-bash appears as the first option (or the only option).
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.
irm https://claude.ai/install.ps1 | iex)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.
a. To edit your PATH, press Win+R, then enter
rundll32 sysdm.cpl,EditEnvironmentVariablesand click OKb. 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, thencdto the directory where you want to run claude from. Since it is in your path now, you should just be able to runclaudeI 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"
}
}
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.
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.
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.
参照上面的方法,发现还是不行,几乎试遍了网络上关于环境变量设置的方法,都行不通。
关键发现,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插件了
C:\Windows\System32\ to PATH (user vars) fixed it for me
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.exeexists2) Set environment variable
CLAUDE_CODE_GIT_BASH_PATHto the full path ofbash.exe3) 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.exeC:\Program Files\Git\usr\bin\bash.exeCheck with PowerShell:
[Environment]::SetEnvironmentVariable(
"CLAUDE_CODE_GIT_BASH_PATH",
"C:\Program Files\Git\bin\bash.exe",
"User"
)
[Environment]::GetEnvironmentVariable("CLAUDE_CODE_GIT_BASH_PATH","User")
$env:CLAUDE_CODE_GIT_BASH_PATH = [Environment]::GetEnvironmentVariable("CLAUDE_CODE_GIT_BASH_PATH","User")
echo $env:CLAUDE_CODE_GIT_BASH_PATH
[Environment]::SetEnvironmentVariable(
"CLAUDE_CODE_GIT_BASH_PATH",
"C:\Program Files\Git\bin\bash.exe",
"Machine"
)
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.
Thank you. Worked 100%
This did not work for me, but creating/modifying the
~/.claude/settings.jsonfile worked:Thank you , this is worked for me
thank you for your response . 100% worked
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):Workaround 2 — Use the SHELL environment variable:
Set the shell explicitly before launching:
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:
Ctrl+``)claudeThis 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 is detected correctly by both the CLI and the extension.
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\Gitexists and inside there's abinfolder and inside that existsbash.exe.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.
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.