执行命令:
composer install
提示:
Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+VM_0_6_centos+2020-03-24+0758
to retrieve a token.
It will be stored in "/root/.config/composer/auth.json" for future use by Composer.
Token (hidden):
不输入 token,直接回车,提示:
Invalid token provided.
You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"
问题的来源:
出现这个问题,原因是 GitHub 的限制(api-rate-limit-and-oauth-tokens),具体详情看这里。
如何解决问题呢?
1、创建 GitHub tokens,点击链接直达.
1.1 选中左侧的: Personal access tokens (Tokens you have generated that can be used to access the Github API).
1.2 点击按钮: Generate new token, -> Select scopes(选择恰当的 scopes,我选了 read:package, gist 两项)
2、添加 auth.json 到项目根目录,auth.json 内容如下:
{
"http-basic": {},
"github-oauth": {
"github.com": "162cd2d43c9cc308c9bc65ba041e7b2245e00975"
}
}
最后执行:
composer install