解决使用 Composer 的时候提示输入 Token

2019-04-03 09:55:11 阅读:8 编辑
如果你没有添加 GitHub 密钥的话,Composer update 会提示你登录:
GitHub API limit (0 calls/hr) is exhausted, could not fetch https://api.github.com/graphql. Create a GitHub OAuth token to go over the API rate limit. You can also wait until 2019-04-02 04:15:47 for the rate limit to reset.

Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+DESKTOP-62 BEULF+2019-04-02+0315
to retrieve a token. It will be stored in "C:\Program Files\Composer/auth.json" for future use by Composer.
Token (hidden):
No token given, aborting.
You can also add it manually later by using "Composer config --global --auth GitHub-oauth.github.com <token>"

  [Composer\Downloader\TransportException]
  Could not authenticate against github.com

解决办法就是:

进入 https://github.com/settings/tokens 点击 「Generate new token」 新建一个 Token, 全部不选择。

命令:

Composer config --global --auth GitHub-oauth.github.com 56 be0776 bae03 e6 fc4 ab164804 e5 b9 a5 fa2 a8659