我正在尝试使用 composer 安装一个 github 项目并得到以下错误
I am trying to install a github project using composer and get the following error
作曲家 [UnexpectedValueException]您的 github.com 的 Github oauth 令牌包含无效字符:"
Composer [UnexpectedValueException] Your Github oauth token for github.com contains invalid characters: ""
谁能解释我需要做什么来纠正这个错误?
Can anyone explain what I need to do to correct this error?
我正在使用以下命令
composer create-project --prefer-dist --stability=dev vova07/yii2-start yii2-start
composer create-project --prefer-dist --stability=dev vova07/yii2-start yii2-start
谢谢
我开始遇到类似的错误,原因是 Github 最近更改了他们的身份验证令牌的格式:
I started getting a similar error and the reason was that Github recently changed the format of their auth tokens:
https://github.blog/changelog/2021-03-31-authentication-token-format-updates-are-generally-available/
解决错误:
找到composer/auth.json
文件(如果您在容器中运行项目,则必须 bash 并在其中找到文件)删除其 github.com
条目.删除条目后,您的文件可能如下所示:{"github-oauth": {}}
运行 composer 自我更新
.该问题在版本 2.0.12
中得到解决.在此处查看该版本更改日志中的第一项:https://getcomposer.org/changelog/2.0.12
Find the composer/auth.json
file (if you're running the project in a container, you'll have to bash into it and find the file in there)
Remove its github.com
entry. Your file will probably look like the following after removing the entry: {"github-oauth": {}}
Run composer self-update
. The issue got resolved in version 2.0.12
. See the first item in the changelog for that version here: https://getcomposer.org/changelog/2.0.12
之后,您可以将 composer/auth.json
文件恢复到其初始状态,因为较新版本的 composer 将识别新的密钥格式.
After that, you can restore your composer/auth.json
file to its initial state as the newer version of composer will recognize the new key format.