温馨提示:这篇文章已超过421天没有更新,请注意相关的内容是否还可用!
摘要:遇到Mac系统brew报错“The GitHub credentials in the macOS keychain may be invalid”时,意味着你的GitHub凭证可能已过期或无效。为了解决这个问题,你可以尝试更新你的GitHub凭证或重置macOS的钥匙串中的凭证。具体操作包括清除钥匙串中的GitHub相关凭证并重新输入正确的凭证信息。如果问题仍然存在,可能需要检查网络连接或联系GitHub客服寻求帮助。
报错信息如下:
$ 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命令测试效果如下
还没有评论,来说两句吧...