Mac系统brew报错“The GitHub credentials in the macOS keychain may be invalid”解决

报错信息如下:

$ brew search nginx
Warning: Error searching on GitHub: GitHub API Error: Requires authentication
The GitHub credentials in the macOS keychain may be invalid.
Clear them with:
  printf "protocol=https\nhost=github.com\n" | git credential-osxkeychain erase
Create a GitHub personal access token:
https://github.com/settings/tokens/new?scopes=gist,repo,workflow&description=Homebrew
echo 'export HOMEBREW_GITHUB_API_TOKEN=your_token_here' >> ~/.zshrc


==> Formulae
nginx

 其中最重要的信息是 “The GitHub credentials in the macOS keychain may be invalid.”,翻译为:“macOS密钥链中的GitHub凭据可能无效”。凭证无效就重新生成就好了。生成方式如下:

1、登录github

Sign in to GitHub · GitHub

2、访问生成token地址

Sign in to GitHub · GitHub

3、生成token

  

4、设置新的token 

在终端执行命令:

export HOMEBREW_GITHUB_API_TOKEN="新生成的token"

设置完再次执行brew命令测试效果如下

猜你喜欢

转载自blog.csdn.net/u011837804/article/details/130299481