GitHub OAuth 令牌在新的 laravel/homestead 条款上的 Composer 错误

Composer error with GitHub OAuth token on fresh laravel/homestead provision

新安装了一个 laravel/homestead vag运行t 盒子,根据文档,运行 init.sh,配置 Homestead.yaml 和 运行 $ vagrant up; vagrant ssh。然后 cd'ed 到项目的文件夹和 运行 composer install.

它挂起等待 token 并显示以下消息

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
- Installing sebastian/diff (1.3.0)
Downloading: Connecting...
Could not fetch https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3, please create a GitHub OAuth token to go over the API rate limit
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+homestead+2015-08-01+2140
to retrieve a token. It will be stored in "/home/vagrant/.composer/auth.json" for future use by Composer.
Token (hidden):

我以前用过 laravel/homestead,我从来没有做过这些,这是一些 未记录的 新功能还是错误,或者我做了什么错了吗?

如果您还没有帐户,则需要创建一个 GitHub 帐户,然后按照说明进行操作 here,然后复制令牌。

获得令牌后,运行 composer 再次安装,然后在提示您输入令牌时粘贴令牌。

该错误表示您已超出 IP 地址的 API 速率限制。

您可以:

  • 稍等一下,然后重试,
  • 更改您的 IP 地址(例如通过代理或 VPN 连接),
  • 按照消息的建议指定您的身份验证令牌:

    Please create a GitHub OAuth token to go over the API rate limit Head to https://github.com/settings/tokens/new?scopes=repo

    并传递到您的 Composer 命令或手动将其添加到 ~/.composer/auth.json,例如

    {
        "http-basic": {},
        "github-oauth": {
            "github.com": "__TOKEN__"}
    }
    

    注意:在Windows,它在%APPDATA%/Composer

    或通过以下命令手动添加设置(按照此comment):

    composer config -g --unset github-oauth.api.github.com
    composer config -g github-oauth.github.com __TOKEN__
    

转到设置,然后从个人访问令牌的开发人员设置,您可以生成一个新令牌