LoginSignup
0

More than 5 years have passed since last update.

gitでdiff toolを指定してgit difftool -dしてもBad file numberする場合の対処

Last updated at Posted at 2014-11-19

概要

gitでdiffツールにWinMarge使おうと思ったらBad file numberしてはまったので...

出るエラー

こんなん

git difftool --dir-diff

/libexec/git-core/git-mergetool--lib:
line 121: D:...\WinMarge.exe: No such file or directory

fatal: 'difftool--helper' appears to be a git command, but we were not
able to execute it. Maybe git-difftool--helper is broken?

C:\Program Files\Git/libexec/git-core\git-difftool line 464: Bad file number

何が悪いのか

.gitconfig
Windowsではユーザーのホームディレクトリにある。

C:\Users\アカウント名.gitconfig

修正する場合これをメモ帳で開く。
まぁNo such file or directory言われてるしパス周りです。

原因1:パスの区切り文字

パスの区切り文字は\/ではなく\で指定した方が良いのかもしれないが本当かどうか判らない。
怖いなら\で指定する。

原因2:文字コード

UTF-8で保存し直せばいい。
UTF-8で保存されてれば日本語フォルダ名が入ってても問題なし。

原因3:ダブルクォーテーション

パスは必ずダブルクォーテーションで括る。
このとき\をダブルクォーテーションの前につけ忘れがちなので注意。
\も2つ並べないといけない事に注意。

[difftool "WinMerge"]
path = \"D:\\Tool\\WinMerge\\x86\\WinMergeU.exe\"
cmd = \"D:\\Tool\\WinMerge\\x86\\WinMergeU.exe\" -r -u \"\$LOCAL\" \"\$REMOTE\"

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0