昨天升级BookStack时,执行composer提示输入token,如果直接回车的话,运行就会中断。

Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
When working with _public_ GitHub repositories only, head to https://github.com/settings/tokens/new?scopes=&description=Composer+on+mindseed+2023-04-21+2210 to retrieve a token.
This token will have read-only permission for public information only.
When you need to access _private_ GitHub repositories as well, go to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+mindseed+2023-04-21+2210
Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.
Tokens will be stored in plain text in "/root/.config/composer/auth.json" for future use by Composer.
For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth
Token (hidden):

查看以前的记录,写的含含糊糊,感觉上跟这次的问题很像,但又不太像。
重新搜索,有结果显示是创建一个私人的token。
登录github站点,点击右上角的头像,再点击settings链接。在设置页面中,点击最下方的Developer settings。
github-settings.png
选择左侧菜单中Personal access tokens,并点击tokens (classic)。然后点击右侧按钮,选择Generate new token (classic),如下图:
github-developer_settings.png
在New personal access token (classic)页面中,note中填写你想要备注的名称,expiration的下拉菜单可以根据自己的实际情况选择几天或No expiration。
github-new_token.png
保存后就可以生成token。
github-token.png
再次回到控制台,重新执行composer命令,当提示输入token时,黏贴刚刚生成的token,执行成功。

参考文章

Git系列——github 配置使用 token 认证

最后修改:2023 年 04 月 22 日
如果觉得我的文章对你有用,请随意赞赏