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

时间:2013-09-20 14:54:29

标签: git composer-php dependency-management

Composer无法在我的json文件中提供的资源库中找到我想要克隆的分支。我得到的错误是:

 [UnexpectedValueException]
 Could not parse version constraint development: Invalid version string "dev
 elopment"

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

{
    "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"
    }
}

2 个答案:

答案 0 :(得分:8)

你的语法错误了。您需要告诉Composer使用分支,然后使用分支名称。所以而不是:

"require": {
    "AdamKyle/Aisis-Core": "development"
}

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

"require": {
    "AdamKyle/Aisis-Core": "dev-development as 2.0.0"
}

'as'右侧的2.0.0是您的分支将别名化的别名。这允许Composer将您的分支视为满足项目中AdamKyle/Aisis-Core的任何其他要求,并将您的分支版本作为2.0.0版。

答案 1 :(得分: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"
    }
}