LoginSignup
4

More than 3 years have passed since last update.

コミットしようとしたらMatched one or more prohibited patternsというエラーが出た

Last updated at Posted at 2019-02-16

原因

こちらに詳しく記載されているのですが、git-secretsが原因みたいです。
git-secretsとはAWS が公開しているツールでパスワードなどの秘密情報を誤って
git リポジトリに commit することを防いでくれるみたいで、防いだ時に出るエラーっぽいです。

GitError.
[ERROR] Matched one or more prohibited patterns

Possible mitigations:
- Mark false positives as allowed using: git config --add secrets.allowed ...
- Mark false positives as allowed by adding regular expressions to .gitallowed at repository's root directory
- List your configured patterns: git config --get-all secrets.patterns
- List your configured allowed patterns: git config --get-all secrets.allowed
- List your configured allowed patterns in .gitallowed at repository's root directory
- Use --no-verify if this is a one-time false positive
 (1)

解決

自分の場合、以下のファイルをコミットしようとした際にエラーが出ました。
以下のファイルはバリデーションテストのファイルでAWSとは全く関係ありません。
おそらく数字、英語で20文字の文字列がある場合にコミットを防ぐのかな、、、??

ちょっと詳しく原因はわかりませんでしたが、英語、数字を使わず、
ひらがなで20文字を再現したことでコミットできるようになりました!

スクリーンショット 2019-02-16 19.02.06.png

追記

下記コマンドで一時的に回避できるみたいです!!

git commit --amend -m "新しいメッセージ" --no-verify

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
What you can do with signing up
4