github和作曲家.拉存储库分支

Log*_*ing 9 git dependency-management composer-php

Composer在我的json文件中提供的存储库中找不到我想要克隆的分支.我得到的错误是:

 [UnexpectedValueException]
 Could not parse version constraint development: Invalid version string "dev
 elopment"
Run Code Online (Sandbox Code Playgroud)

我想我不能说,去这个地方,从这个分支克隆?

{
    "repositories": [
        {
            "type":"package",
            "package": {
                "name": "AdamKyle/Aisis-Core",
                "version":"development",
                "source": {
                    "url": "https://github.com/AdamKyle/Aisis-Core.git",
                    "type": "git",
                    "reference":"development"
                }
            }
        }
    ],
    "require": {
        "AdamKyle/Aisis-Core": "development"
    }
}
Run Code Online (Sandbox Code Playgroud)

Dan*_*ack 8

你的语法错误了.您需要告诉Composer使用分支,然后使用分支名称.所以代替:

"require": {
    "AdamKyle/Aisis-Core": "development"
}
Run Code Online (Sandbox Code Playgroud)

假设您的分支被称为"开发",它应该是

"require": {
    "AdamKyle/Aisis-Core": "dev-development as 2.0.0"
}
Run Code Online (Sandbox Code Playgroud)

2.0.0到右边的"作为"是你的分支将化名为别名.这允许Composer将您的分支视为满足AdamKyle/Aisis-Core您的分支版本为2.0.0的项目中的任何其他要求.


nur*_*abe 5

我自己遇到了这个问题.我认为正确的方法是在源代码下引用分支,然后给它一个dev-branch版本:

{
    "repositories": [
        {
            "type":"package",
            "package": {
                "name": "AdamKyle/Aisis-Core",
                "version":"dev-development",
                "source": {
                    "url": "https://github.com/AdamKyle/Aisis-Core.git",
                    "type": "git",
                    "reference":"development"
                }
            }
        }
    ],
    "require": {
        "AdamKyle/Aisis-Core": "dev-development"
    }
}
Run Code Online (Sandbox Code Playgroud)