composer 安装更新的时候,提示需要token
展开阅读全文

今天下载了flarumchina,执行

composer install
composer update

这2个其中一个的时候,发生了以下错误:

Could not fetch https://api.github.com/repos/FlarumChina/core, 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+USER-20170110XY+2017-07-29+0808
to retrieve a token. It will be stored in "C:/Users/Administrator/AppData/Roaming/Composer/auth.json" for future use by Composer.
Token (hidden):

翻译后大概的意思就是这样:

不能提取https://api.github.com/repos/flarumchina/core,请创建一个GitHub OAuth令牌去API速率限制

头https://github.com/settings/tokens/new?范围=回购与描述=作曲家+ + + + 0808 user-20170110xy 2017-07-29

检索令牌。它将保存在“C:/用户/管理员/数据/漫游/作曲家/认证。JSON”由作曲家将来使用。

令牌(隐藏):

解决方法:

复制以上链接

https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+USER-20170110XY+2017-07-29+0808

然后跳转到github页面,输入账户密码,然后出来一个

New personal access token

Personal access tokens function like ordinary OAuth access tokens. They can be used instead of a password for Git over HTTPS, or can be used to authenticate to the API over Basic Authentication.

Token description
...
...

页面,直接点击下面的绿色按钮:Generate token,然后跳转到一个token页面,复制token参数,然后直接粘贴到上方需要输入token的命令行里面。