我的 PHP 项目依赖于一个不错的库 php-sql-query-builder 。然而,这个库有一个错误。因此,我将库从 github 源代码 fork 到我的 github 帐户 https://github.com/mmuhasan/php-sql-query-builder并修复名为“dev-where-bug-fix”的分支中的错误。然后我更新了我的项目 Composer 文件,如下所示:
....
"repositories": [
{
"type": "vcs",
"url": "https://github.com/mmuhasan/php-sql-query-builder"
}
],
"require":{
"nilportugues/sql-query-builder" : "dev-where-bug-fix"
},
....
当我运行 composer update
时,它会要求 oAuth token ,如下所示:
Could not fetch https://api.github.com/repos/mmuhasan/php-sql-query-builder/contents/composer.json?ref=3dca30b0eaee835783fa61286a51dda425cd3838, 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+LAPTOP-056S12EK+2018-03-27+1845 to retrieve a token.
既然我的 fork 是公开的,并且我希望它是公开的,为什么 Composer 要求 token 。任何帮助将非常感激。
最佳答案
这与公共(public)和私有(private) GitHub 存储库无关。您正在点击GitHub's API rate limit .
来自Composer's troubleshooting guide :
API rate limit and OAuth tokens
Because of GitHub's rate limits on their API it can happen that Composer prompts for authentication asking your username and password so it can go ahead with its work.
If you would prefer not to provide your GitHub credentials to Composer you can manually create a token using the following procedure:
- Create an OAuth token on GitHub. Read more on this.
- Add it to the configuration running
composer config -g github-oauth.github.com <oauthtoken>
Now Composer should install/update without asking for authentication.
关于php - Composer 要求 oauth token 下载公共(public)存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49518579/