環境変数

CLAUDE_CODE_GIT_BASH_PATH

Windows 専用: Git Bash 実行ファイル(bash.exe)へのパスである。Git Bash がインストールされているのに PATH に含まれない場合に使う。パスが存在しない場合やファイル名が bash.exe、sh.exe、bash、sh のいずれでもない場合、Claude Code はこの変数を無視して、未設定の場合と同様に Git Bash を自動検出し、--debug で表示可能な警告をログに出力する。v2.1.219 より前では、パスが存在しない場合に Claude Code は起動時に終了し、存在する任意のファイルを bash や sh かどうかを確認せずにシェルとして使っていた

使い方・用途

  • Git Bash がインストール済みだが PATH に含まれておらず Claude Code が見つけられない場合に、Git Bash の実行ファイル (bash.exe) のパスを明示的に指定する。
  • Git Bash 向けに書かれた hook が Windows 上で失敗する場合に、Claude Code が Git Bash を見つけられるようにして Bash 用 hook を動作させる。
  • 存在しないパスや bash/sh 以外のファイル名 (例: git-bash.exe) を指定してしまい変数が無視される事態を避けるため、bash.exe・sh.exe・bash・sh いずれかの名前の実在ファイルを指定する。
英語原文(公式ドキュメントより)

Windows only: path to the Git Bash executable (bash.exe). Use when Git Bash is installed but not in your PATH. If the path doesn't exist or the file isn't named bash.exe, sh.exe, bash, or sh, Claude Code ignores the variable and auto-detects Git Bash as if it were unset, logging a warning visible with --debug. Before v2.1.219, Claude Code exited at startup when the path didn't exist, and used any existing file as the shell without checking that it was bash or sh. See Windows setup

関連ドキュメント

関連する変更履歴

v2.1.219(1件)

Fixed
Windows上でCLAUDE_CODE_GIT_BASH_PATHにbash以外のバイナリが指定された場合、強制終了せず警告を表示するように変更しました。
英語原文を表示
Fixed CLAUDE_CODE_GIT_BASH_PATH on Windows exiting or being used as bash when the path isn't a bash/sh binary; it's now ignored with a warning

変更後

設定ミスによってツールが即座にクラッシュすることを避け、適切なエラーメッセージを見て修正を行えます。

関連ドキュメント

v2.1.98(1件)

Fixed
Windows版VS Codeにて、Gitが標準的な場所にインストールされている、または CLAUDE_CODE_GIT_BASH_PATH が正しく設定されている場合でも「Git Bashが必要」という誤判定エラーが出る問題を修正
英語原文を表示
[VSCode] Fixed false-positive "requires git-bash" error on Windows when CLAUDE_CODE_GIT_BASH_PATH is set or Git is installed at a default location

変更後

WindowsユーザーがVS Codeの統合ターミナルからClaude Codeを起動する際、不要なエラーに悩まされることなく、スムーズに開発を開始できます。

関連ドキュメント