【问题标题】:How to use custom gitlab repository in symfony如何在 symfony 中使用自定义 gitlab 存储库
【发布时间】:2021-05-15 17:34:58
【问题描述】:

我开发了自定义的 symfony 包并将其存储在 gitlab 存储库中。 我想在我的 symfony 项目中使用这个包,但是当我尝试通过 composer 安装这个包时遇到错误。

因为它是自定义私有仓库,所以我在我的项目 composer.json 中添加了自定义仓库 URL

"repositories": [
    {
        "type" : "vcs",
        "url"  : "git@gitlab.com:custom-team/customn-symfony-bundle.git"
    }
],

但是当我尝试执行composer require custom-team/customn-symfony-bundle:dev-master 时,我收到以下错误:

找不到包 custom-team/custom-symfony-bundle 的匹配版本。检查包拼写、版本限制以及包的稳定性是否与您的最低稳定性 (dev) 相匹配。

什么是错误?我需要在我的 symfony 包 repo 中进行哪些更改?

【问题讨论】:

  • 这个仓库的 composer.json 长什么样子?
  • 请分享更多细节。另外,这甚至与 Symfony 或 Gitlab 有关吗?

标签: php symfony gitlab composer-php bundle


【解决方案1】:

抱歉,我通过文档找到了解决方案:https://docs.gitlab.com/ee/user/packages/package_registry/index.html

创建的包:

curl --data branch=MYBRANCH "https://__token__:MYTOKEN@gitlab.com/api/v4/projects/<PACKAGE_ID>/packages/composer"

并在composer.json中添加

composer config repositories.gitlab.com/<ID> '{"type": "composer", "url": "https://gitlab.com/api/v4/group/<ID>/-/packages/composer/packages.json"}'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-02
    相关资源
    最近更新 更多