Composer 使用存储库的私有分支

Composer use private fork of a repository

这个问题在其他地方回答的很清楚,但对我来说根本不起作用。我也看到很多人对此有疑问。

我正在尝试在我自己的项目中使用 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 url : 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/'   

我做错了什么?

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

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

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

标签更新后。 VCS 方法有效。