无法从私人的GitLab存储库(名称空间)进行作曲家的安装/要求

时间:2019-10-23 12:55:27

标签: git composer-php gitlab

我在从私人GitLab存储库安装私人作曲家库时遇到问题。

我要使用的私有库的composer.json中有这个私有库,并存储在我的GitLab中:

{
    "name": "zlatan/app-client",
    "type": "library",
    "license": "MIT",
    "description": "Client in PHP",
    "authors": [
        {
            "name": "Zlatan Omerovic",
            "email": "gmail@com.zlatan"
        }
    ],
    "require": {
        "symfony/http-client": "^4.3"
    },
    "autoload": {
        "psr-4": {
            "AppClient\\": "src/"
        }
    }
}

我到库的Git路径为:/namespace/project/app-client.git,即

git@zlatan.gitlab.com:namespace/project/app-client.git

现在我想在另一个zlatan/app-client文件中使用命名为composer.json的库:

{
    "name": "zlatan/composer",
    "authors": [
        {
            "name": "Zlatan Omerovic",
            "email": "gmail@com.zlatan"
        }
    ],
    "require": {
        "zlatan/app-client": "master"
    },
    "repositories": [
        {
            "type": "git",
            "url": "git@zlatan.gitlab.com:namespace/project/app-client.git"
        }
    ]
}

现在,当我运行composer install时,总是得到以下输出:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package zlatan/app-client could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

我的第一个也是唯一的猜测是URI中的这些GitLab名称空间/前缀会引起问题吗?

有可能解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

尝试使用dev-master引用您的master分支。

使用master将指示Composer搜索名为master的标签,如果该标签不存在,它将失败。

此外,您可以尝试将"minimum-stability": "dev"添加到composer.json中,以确保可以安装软件包的开发版本。