0
0

More than 1 year has passed since last update.

git-secretsでコミットができなくなった場合の対処法

Posted at

環境

ソースツリー

概要

git-secretsによって、コミットできなくなった場合の対処法の記事はたくさんあるが、
それでは対処できなかったので、備忘録として残しておく。今回は、一旦git-secretsを完全に取り除いてコミットさせるようにする。

エラー内容

git: 'secrets' is not a git command. See 'git --help'.

解決手順

①git-secretsをアンインストールする。

$ brew uninstall git-secrets

これでコミットできるようになったかと思いきや、またしても以下のエラーが出る。

git: 'secrets' is not a git command. See 'git --help'.

調べていくうちに、各リポジトリの「.git/hooks」にある「commit-msg, pre-commit, prepare-commit-msg」の3つを消さなければいけないらしい。

② 削除する

該当のリポジトリに移動する。

まずはviでファイルの中身を確認する
[*****@*****: (master +)リポジトリ名]$ vi .git/hooks/

開いてみると、commit-msg* とpre-commitとprepare-commit-msgの3つが確認できた。

該当のファイルを削除する
[*****@*****: (master +)リポジトリ名]$ rm -f .git/hooks/commit-msg*
該当のファイルを削除する
[*****@*****: (master +)リポジトリ名]$ rm -f .git/hooks/pre-commit*
該当のファイルを削除する
[*****@*****: (master +)リポジトリ名]$ rm -f .git/hooks/prepare-commit-msg*

私の場合、上記の作業でコミットできるようになった。

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