LoginSignup
26
15

More than 3 years have passed since last update.

"git-credential-osxkeychain"の真正性を確認できません、、の対処法

Last updated at Posted at 2021-01-05

状況

Macに標準で入っているgitをHomebrewで管理するようにした後、brew searchコマンドを実行すると、画像のポップアップが出てきて、「拒否」のボタンしか押せない。

image.png

解決策

GitHubの公式ドキュメントに答えがありました。スポットライトでKeychain accessと打ってアクセスした後、github.comのinternet passwordを削除すればポップアップは表示されなくなり、コマンドも使えるようになりました。

原因

そもそもなぜこのようなポップアップが表示されたのでしょうか。これも先ほどの公式ページのリンクから引用させていただきます。

You should create a personal access token to use in place of a password with the command line or with the API. Personal access tokens (PATs) are an alternative to using passwords for authentication to GitHub when using the GitHub API or the command line.

要は、「パスワードを使ってAuthentificationする方法が廃止されるので、代わりにPATs(自分のリポジトリで発行したトークン)を使ってね。」ということになります。したがって、このパスワードを削除してしまって、コマンドを実行すれば(最初はユーザー名とパスワードが要求される)いいわけです。

余談

brewでgitをインストールした際には合わせてgit secretsもインストールしないとコマンド実行した際にエラーが出ます。このgit secretのよって、例えば「AWSの秘密鍵を誤ってコミットしてしまった」ということを防ぐことができます。ただし、インストールするだけでは有効にならないので、自分で設定する必要があります。設定方法については以下の記事が参考になりました。

git-secretsはじめました

26
15
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
26
15