Repository navigation
Description
Description
Desktop app ignores OPENCODE_GIT_BASH_PATH.
when execution with BashTool, always uses SHELL (WSL) on Windows
Environment:
- OS: Windows 10
- OpenCode: Desktop version
- Git Bash: Installed at
C:\Program Files\Git\bin\bash.exe - WSL: Ubuntu installed
OPENCODE_GIT_BASH_PATHset toC:\Program Files\Git\bin\bash.exein Windows environment variables
$ where bash
C:\Program Files\Git\usr\bin\bash.exe
C:\Windows\System32\bash.exe
Description:
The desktop app ignores the OPENCODE_GIT_BASH_PATH environment variable when spawning the CLI sidecar. The CLI shell detection logic in shell.ts prioritizes process.env.SHELL over OPENCODE_GIT_BASH_PATH, causing it to use WSL bash instead of Git Bash. This breaks the Bash tool since Windows environment variables (PATH, PYTHONPATH, etc.) are not inherited by the WSL environment.
Reproduction:
- Install OpenCode Desktop on Windows
- Install Git Bash and WSL
- Set
OPENCODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exein Windows environment variables
Expected Behavior:
The Bash tool should use Git Bash as configured via OPENCODE_GIT_BASH_PATH, preserving all Windows environment variables.
Actual Behavior:
The Bash tool uses WSL bash (from SHELL environment variable), causing:
- All Windows environment variables to be unavailable
- Commands requiring Windows tools to fail
- Configurations in Git Bash (PATH, npm, Python, etc.) to be ignored
Root Cause:
In packages/desktop/src-tauri/src/cli.rs, the create_command() function for Windows does not pass the OPENCODE_GIT_BASH_PATH environment variable to the CLI sidecar:
#[cfg(target_os = "windows")]
pub fn create_command(app: &tauri::AppHandle, args: &str) -> Command {
// ... existing env variables ...
.env("OPENCODE_CLIENT", "desktop")
.env("XDG_STATE_HOME", &state_dir);
// Missing: .env("OPENCODE_GIT_BASH_PATH", ...)
}The CLI's shell detection in packages/opencode/src/shell/shell.ts prioritizes SHELL:
export const acceptable = lazy(() => {
const s = process.env.SHELL // Checked first
if (s && !BLACKLIST.has(...)) return s
return fallback() // OPENCODE_GIT_BASH_PATH is only checked here
})Plugins
No response
OpenCode version
1.1.19
Steps to reproduce
1.Git-Bash Installed.
2.WSL Installed.
Screenshot and/or share link
No response
Operating System
Win10 22H2
Terminal
OpenCode-Desktop-Win64
Activity
github-actions commentedon Jan 14, 2026
This issue might be a duplicate of existing issues. Please check:
process.env.SHELLnot being properly handled in WSL/Windows environmentsFeel free to ignore if this doesn't address your specific case.
pschiel commentedon Jan 15, 2026
You need to get your PATH order right in order for this to work.
WSL bash lives in C:/Windows/System32
if you want git bash to be executed, this needs to have higher priority:
on top you can also set both env variables
SHELLandOPENCODE_GIT_BASH_PATHto be on the safe side:anddam commentedon Jan 19, 2026
@mizaibear
Check https://learn.microsoft.com/en-us/windows/wsl/wsl-config#interop-settings for adding windows PATH to the WSL env, and https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows/ for the other vars.
pschiel commentedon Jan 19, 2026
Mixing both systems will cause a lot of errors, because WSL cant handle Windows paths at all. Working with Windows programs, those paths will inevitably occur.
Windows paths are added by default and can be removed with
Git bash, MSYS, Powershell, cmd, were already a challenge to get fixed, you're setting yourself up for a whole bunch of issues. WSL works if you stay inside its VM.