1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Gitにてgit: ‘secrets’ is not a git command. See ‘git --help’.のエラーが出た時

Last updated at Posted at 2021-07-13

こんにちは

最近はSourceTreeと言うツールを使っているのですが、

そこにおいて作業中に初コミットした時にエラーが。。。

git: ‘secrets’ is not a git command. See ‘git --help’.

直訳すると「git: 'secrets' は git のコマンドではありません。git --help'を参照してください。」と

正直全く意味がわかりません。笑

調べてみると
・git-secretsがコミットの邪魔をしている
・ターミナルにてローカルリポジトリ内の.git/hooksにある、commit-msg, pre-commit, prepare-commit-msgを削除する必要がある
・git-secretsをインストール/アンインストール

まずなんですがAWS等で不正利用されないように
git-secretsが必要になってくるみたいです(詳しいことは分かりませんが)

これに対して
「あっそういえば自分過去にAWSでデプロイしたな」と思い浮かべ、これだと思い直ちにgit-secretsの設定をしましたが、うまくいかず、、、

自分の中でググって同じページを何回も見返したりしましたが、解決せずの繰り返しでした。

そこでなんとなくgit-secretsの場所を確認してみることに

$ which git-secrets
/usr/local/bin/git-secrets

/usr/local/bin/の中にgit-secretsが存在しており

SourceTree側の設定を確認したところ
「内蔵のgit」になっていることが確認でき、すぐさま「システムのgit」へ変更

この際の注意点ですが、ちゃんと/usr/local/bin/gitで指定するように!

改めてcommitした所、成功!!!!

今回の原因といたしましてはソースツリー側のファイルの指定が誤っていたことが原因でした。

もちろん前半で上げた原因もございますが
自分はこれで解決致しました。

SourceTreeを使うエンジニアさんは登竜門の可能性大です!笑

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?