如何将本地git存储库添加到satis服务器

时间:2018-09-18 22:22:36

标签: git composer-php satis

我正在尝试对必须通过create-project命令启动的composer项目进行测试。我已经可以通过在所讨论的仓库中手动创建packages.json文件来做到这一点:

{
  "package": {
    "name": "me/my-project",
    "version": "1.0.0",
    "source": {
      "url": "/literal/filepath/to/repo/root/.git",
      "type": "git",
      "reference": "feature/branch_being_tested"
    }
  }
}

然后通过运行像这样的create-project命令:

rm -rf ~/.composer/cache/vcs/; composer create-project me/my-project

第一步是为作曲家清除本地版本控制缓存,这样,如果我在本地对分支进行了更改,则作曲家缓存将识别出更改(一个人也可以执行composer clearcache,但是重建需要花费更长的时间。

我想做的是能够使用我的本地satis服务器为我跟踪此情况,因此我不必指定存储库URL。

我已经在作曲家的composer.json文件中为我的satis服务器建立了一个条目,如下所示:

{
    "repositories": [
    {
      "type": "composer",
      "url": "https://satis-server.local",
      "options": {
        "ssl": {
          "verify_peer": true,
          "allow_self_signed": true
        }
      }
    }]
}

(这很好;我添加它是为了完整性)。

我的satis.json看起来像这样:

{
    "name": "My Local Satis Repository",
    "homepage": "https://satis-server.local",
    "repositories": [{
        "type": "package",
        "package": {
            "name": "me/my-project",
            "version": "1.0.0",
            "source": {
                "url": "/literal/filepath/to/repo/root/.git",
                "type": "git",
                "reference": "feature/branch_being_tested"
            }
        }
    }],
    "require-all": true,
    "require-dependencies": false,
    "require-dev-dependencies": false,
}

这很好,但是尝试从中创建项目时出现异常:

[InvalidArgumentException]
Could not find package me/my-project with stability stable.

我也尝试过:

{
    "type": "git",
    "url": "file:///literal/filepath/to/repo/root/.git"
}

这让我:

[Composer\Repository\InvalidRepositoryException]
No valid composer.json was found in any branch or tag of file:///literal/filepath/to/repo/root/.git.git, could not load a package from it.

很明显,我在解释一些实际错误,但是您明白了。

file配置中声明本地存储库(通过url而不是satis.json的正确语法是什么?

0 个答案:

没有答案
相关问题