brew search xxx した時に出てきたGitHub資格情報無効エラーを直した話

タイトルの通りです。

エラー内容

$ brew search pebble
==> Searching local taps...
==> Searching taps on GitHub...
Error: GitHub 
The GitHub credentials in the macOS keychain may be invalid.
Clear them with:
  printf "protocol=https\nhost=github.com\n" | git credential-osxkeychain erase
Or create a personal access token:
  https://github.com/settings/tokens/new?scopes=gist,public_repo&description=Homebrew
and then set the token as: export HOMEBREW_GITHUB_API_TOKEN="your_new_token"

対処方法

  1. macOSキーチェーンのGitHub資格情報をクリアしなさい、とあるのでクリアしてみる
$  printf "protocol=https\nhost=github.com\n" | git credential-osxkeychain erase
  1. もう一度 brew search xxx してみる
$ brew search xxx
==> Searching local taps...
==> Searching taps on GitHub...
==> Searching blacklisted, migrated and deleted formulae...

うまく行きました。