如何在composer.json中为相同的VCS定义定义http和ssh?

问题描述 投票:0回答:1

在我的composer.json中,我将vcs存储库定义为:

{
    "repositories":[
      {
        "type": "vcs",
        "url": "[email protected]:vendor/secret.git"
      }
    ]
}

但有些人更喜欢使用用户名和密码,而有些人则为用户提供 ssh 密钥。因此,我还想通过 http 定义相同的 VCS 存储库,因此对于同一个包,将使用 http 或 ssh。

我怎样才能做到这一点?

php http ssh composer-php
1个回答
0
投票

您可以尝试指定多个存储库条目,每个条目具有不同的 URL 格式。像这样的东西:

{
    "repositories":[
      {
        "type": "vcs",
        "url": "[email protected]:vendor/secret.git"
      },
      {
        "type": "vcs",
        "url": "https://github.com/vendor/secret.git"
      }
    ]
}

© www.soinside.com 2019 - 2024. All rights reserved.