【问题标题】:Could not fetch [repository], please review your configured GitHub OAuth token when running "composer update"无法获取 [repository],请在运行“composer update”时检查您配置的 GitHub OAuth 令牌
【发布时间】:2022-07-15 19:54:19
【问题描述】:

当我运行composer update 时,我收到以下错误:

无法获取 https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf,请检查您配置的 GitHub OAuth 令牌或输入新令牌以访问私有存储库。仅使用公共 GitHub 存储库时,请前往 https://github.com/settings/tokens/new?scopes=&description=Composer 检索令牌。

然后我转到“https://github.com/settings/tokens/new”,生成一个新令牌并使用以下命令进行设置:

composer config --global github-oauth.github.com [token]

即使在那之后,当我运行composer update 时,我也会遇到同样的错误。我该如何解决这个问题?

【问题讨论】:

  • 看起来像一个临时问题,也许?有问题的存储库不是私有存储库。

标签: php composer-php github-api


【解决方案1】:

我刚刚遇到了同样的问题,这是由于我的 auth.json 文件中的凭据不正确。两个建议:

  • auth.json 文件中定义正确的凭据,如文档中所述:
{
    "http-basic": {
        "example.org": {
            "username": "username",
            "password": "password"
        }
    },
    "github-oauth": {
        "github.com": "ghp_your_token_here"
    }
}
  • 或者如果您不需要这个,只需删除auth.json 文件即可。

希望这会有所帮助!

【讨论】:

    【解决方案2】:

    您在命令中缺少--auth。 命令应该是:composer config --global --auth github-oauth.github.com [token]

    【讨论】:

      猜你喜欢
      • 2021-11-08
      • 2015-10-24
      • 1970-01-01
      • 2015-09-11
      • 2020-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多