【问题标题】:Composer use private fork of a repositoryComposer 使用存储库的私有分支
【发布时间】:2019-11-04 18:42:05
【问题描述】:

这个问题在其他地方得到了明确的回答,但它根本不适合我。我也可以看到很多人对此有疑问。

我正在尝试在我自己的项目中使用 CCXT 的一个分支(分支名称是 bitmart),因为它包含一些尚未与原始 ccxt/ccxt 合并的重大更改

git 版本:2.20.1
作曲家版本 1.7.2

我的项目中的作曲家文件如下所示:

"repositories": [{
    "type": "vcs",
    "url": "git@github.com:devsi/ccxt"
}],
 "require": {
    "ccxt/ccxt": "dev-bitmart as 1.18.409"
}

我已经尝试了 https 网址:https://github.com/devsi/ccxt,但它仍然无法正常工作。

我已经尝试删除版本约束,而是尝试读取 CCXT 中的每个版本。处理时间将需要数小时。它大约每秒执行 1 次。

Reading composer.json of ccxt/ccxt (1.17.378)
Reading composer.json of ccxt/ccxt (1.17.377)
Reading composer.json of ccxt/ccxt (1.17.376)

等等。

指定版本时,我收到的错误是:

Failed to clone the git@github.com:devsi/ccxt.git repository, 
try running in interactive mode so that you can enter your GitHub credentials


  [RuntimeException]                                                                                                               
  Failed to execute git clone --mirror 'git@github.com:devsi/ccxt.git' '/root/.composer/cache/vcs/git-github.com-devsi-ccxt.git/'   

我做错了什么?

【问题讨论】:

  • 我可以毫无问题地克隆它,我已经使用了几个星期,所以我认为它与凭据无关。
  • 我认为composer需要单独配置github访问:-previousnext.com.au/blog/…-google.com/search?q=composer+github+oauth+key
  • @IgorKroitor 不知何故你总是最​​终帮助我!在 CCXT、电子邮件或 StackOverflow 上。所以这行得通,但是它仍然不得不阅读曾经发布的每个版本的 CCXT。我现在正在观看它,它从 1.18.409 退后,一次发布一个版本。每秒一个。它可能会在几个小时内更新我的供应商......
  • 我现在已经将我的 fork 提交给了 Packagist 并直接使用它。 (重命名了包,并删除了关键字,所以我不会经常被搜索)。除非我弄清楚为什么作曲家不让我拉叉子,否则这将不得不暂时进行。

标签: git github composer-php git-fork ccxt


【解决方案1】:

因此,对于发现此问题的其他任何人。我的存储库分支是最新版本的原始源代码。但是,标签不是。由于 git fetch 不获取标签,因此在同步您的 fork 和源代码时,请确保您还 git fetch upstream --tagsgit push --tags 以使版本也保持最新。如果没有这个,我会收到一个关于凭据和无法执行 git clone 的模糊警告。真正的错误是:

[InvalidArgumentException]                                                                                                                                            
  Could not find a version of package devsi/ccxt matching your minimum-stability (dev)

这也解释了为什么它要逐个阅读每个版本。它永远找不到它需要的版本,因为它在分叉的 repo 中不可用。

一旦标签是最新的。 VCS 方法奏效了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-19
    • 2014-05-19
    • 2016-05-10
    • 2017-02-03
    • 1970-01-01
    • 2014-03-22
    • 2023-03-09
    • 2017-01-04
    相关资源
    最近更新 更多