Skip to content

Windows: Git Bash auto-detection derives invalid bash.exe path #10871

@MaxMiksa

Description

@MaxMiksa

Description

On Windows, shell auto-detection derives a Git Bash path from Bun.which("git"), but currently treats git.exe as a directory when building the bash.exe path. This can cause Opencode to fall back to cmd.exe even when Git Bash is installed.

Plugins

N/A

OpenCode version

dev (local checkout @ 213c0e18a, package packages/opencode v1.1.36)

Steps to reproduce

  1. Windows with Git for Windows installed (git available on PATH)
  2. Ensure SHELL is unset and OPENCODE_GIT_BASH_PATH is unset
  3. Trigger the bash tool (any tool call that uses Shell.acceptable())
  4. Observe the selected shell path: it may not resolve to the actual Git Bash binary.

Operating System

Windows 11

Terminal

Windows Terminal

Expected

If git.exe is found (e.g. ...\\Git\\cmd\\git.exe), Opencode should derive Git Bash from path.dirname(git) (e.g. ...\\Git\\bin\\bash.exe).

Actual

The derived path may be built from path.join(git, "..", "..", "bin", "bash.exe"), which treats git.exe as a directory and can produce an invalid bash.exe path.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions