クレデンシャルを公開しないようにしてくれるgit-secretsは便利ですが、IDEで追加設定をしないと使えない場合があります。
問題
MacでIntelliJを使用時、git-secretsで管理されているフォルダでコミットすると、以下のようなエラーでコミットできません。
0 files committed, 1 file failed to commit: add gatling sample git: 'secrets' is not a git command. See 'git --help'.
解決
原因は、intelliJのgit実行のパスにあります。デフォルトだと/usr/bin/git
を使用します。
一方、macのbrewでgit-secretsを入れた場合は、git-secretsパスは/usr/local/bin/
になるので、デフォルトだと見てくれません。
そこで、gitの実行パスを変えましょう。
IntelliJで Preference → Version Control → Git と行き、
Path to Git executableのパスを/usr/local/bin/git
と変更しApplyします。
無事コミットできればOKです。