LoginSignup
5
5

More than 5 years have passed since last update.

GitHub Desktopでもgit-secretsが使いたい

Last updated at Posted at 2017-02-21

問題

GitHub Desktopでコミットしようとしたら次のようなエラーが出た。
image

状況

原因

これは以下のprehookの実行時に起こっているエラーである。

#!/usr/bin/env bash
git secrets --pre_commit_hook -- "$@"

(このprehookはbrewでgit-secretsを入れる際に定義される。)

GitHub Desktopを実行する際にgit-secretsが読み込めていない。

解決方法

cd /Applications/GitHub Desktop.app/Contents/Resources/git/bin
ln -s /usr/local/bin/git-secrets

解説

GitHub Desktopは自分のパッケージに含まれるGitを使う(システムのGitを使うようにする設定項目は見当たらない)。
git-secretsを使うためにはgitの実体がある階層にシンボリックリンクを貼ればよいので、はる。

GitHub Desktopが利用しているGitのpathの調べ方

GitHub Desktopが利用しているgitの実体は、Gitのprehookの仕組みを使うことで、GitHub Desktopでのコミットの際にpathを出力することで確認ができる。
具体的にはコミットしたいリポジトリの.git/hooks/pre-commitwhich gitを書いておく。

5
5
0

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
5
5