php - Composer 要求 oauth token 下载公共(public)存储库

标签 php github composer-php dependency-management

我的 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:

  1. Create an OAuth token on GitHub. Read more on this.
  2. 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/

相关文章:

php - 使用简单的 HTML DOM 解析器解析 JSON?

php - Codeigniter 需要从一个模块连接到另一个模块

git - 在 GitHub 上 fork 私有(private)仓库有什么好处吗?

php - composer update 给出关于私有(private)存储库元数据的 404

php - 是否可以使用 Composer 从 Gitlab 上的存储库安装软件包?

php - Composer 完成执行后退出批处理文件

php - 如何从我的 PHP 应用程序获取用户的 Windows 用户名?

php - 如何告诉 ZF2 的 JsonModel 返回 text/plain 而不是 application/json?

git - 如何更新下载为 ZIP 文件的 GitHub 项目?

github - 我可以在没有后端服务器的情况下通过 Chrome 扩展程序的 Github 帐户对用户进行身份验证吗?