使用brew报错:Bad credentials/GitHub API Error: API rate limit exceeded for

在使用XHProf性能分析工具时,由于缺少graphviz,尝试通过brew安装,但遇到了'Bad credentials/GitHub API Error: API rate limit exceeded for'的错误。解决方法包括清除系统钥匙串中的GitHub证书或生成新的个人访问TOKEN。通过设置环境变量HOMEBREW_GITHUB_API_TOKEN为新的TOKEN,成功安装graphviz,并使XHProf能正常显示图像。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

背景描述

XHProf是一个轻量级的PHP性能分析工具.

使用XHProf的时候,在点击[View Full Callgraph]查看结果分析图时,会报错, 原因是缺少graphviz绘图软件。

在使用 brew安装graphviz软件出现了一些错误,特此记录一下.

具体内容

首先使用brew搜索是否存在graphviz软件,报错:

$ brew search graphviz
Error: GitHub {
  "message": "Bad credentials",
  "documentation_url": "https://developer.github.com/v3"
}
The GitHub credentials in the OS X 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=&description=Homebrew
and then set the token as:
  export HOMEBREW_GITHUB_API_TOKEN="your_new_token"

这个错误描述的很清楚,系统钥匙串中的GitHub证书可能已失效。 解决办法也有了: (1) 清除 (2)或者重新生成一个TOKEN

按照第一种方式,报错:

$ printf "protocol=https\nhost=github.com\n" | git credential-osxkeychain erase
$ brew search graphviz
Error: GitHub API Error: API rate limit exceeded for 116.236.188.123.
(But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)
Try again in 48 minutes 33 seconds, or create a personal access token:
  https://github.com/settings/tokens/new?scopes=&description=Homebrew
and then set the token as: export HOMEBREW_GITHUB_API_TOKEN="your_new_token"

创建一个私人的访问TOKEN:

打开链接:

https://github.com/settings/tokens/new?scopes=&description=Homebrew

点击 "Generate token” 按钮,生成TOKEN, 比如本次生成的TOKEN: 00dc6141d83e69ec1fc3bwyt68cnwyt82eb063bd

在终端执行: export HOMEBREW_GITHUB_API_TOKEN=“your_new_token"

$ export HOMEBREW_GITHUB_API_TOKEN="00dc6141d83e69ec1fc3bwyt68cnwyt82eb063bd"
// 继续安装软件
$ brew search graphviz
$ brew install graphviz

graphviz安装成功。 在XHProf结果报告中点击[View Full Callgraph]也会生成图像。

扩展内容

XHProf是一个轻量级的PHP性能分析工具(层次式性能分析器,Hierarchical Profiler)。 Graphviz is open source graph visualization software。 Brew 又叫Homebrew, 是Mac OSX上的软件包管理工具。

参考链接

http://www.graphviz.org/ http://avnpc.com/pages/profiler-php-performance-online-by-xhprof http://www.cnblogs.com/phoenix-fec/p/5286695.html

[END]

转载于:https://my.oschina.net/wangyongtao/blog/745603

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值