Composer vcs安装在Gitolite上

时间:2016-02-08 22:29:46

标签: git version-control composer-php gitolite

我使用composer.json

在我的gitolite服务器上创建了一个库
{
    "name": "package/package-name",
    "type": "library",
    "description": "Wine Extension for Wordpress",
    "keywords": ["Page Management"],
    "license": "MIT",
    "authors": [
        {
            "name": "Author",
            "email": "author@email.com"
        }
    ],
    "require": {
        "php": ">=5.3.2"
    },
    "autoload": {
      "psr-4": { "Prefix\\PackageName\\": "src/" }
    },
    "extra": {
        "branch-alias": {
            "dev-master": "master"
        }
    }
}

然后我想将它们包含在其他项目中,所以我添加了这样的存储库。

[
    "repositories": [
        {
            "type": "vcs",
            "url": "git@my-server.com:Library/PackageName"
        }
    ],
    "require": {
        "package/package-name": "master",
    },
]

我在github上的另一个库上有完全相同的composer.json文件。然而,在Github它可以工作,但不是在gitolite。我想知道这是否与Gitolite有关,如果Gitolite不支持它。有人可以向我解释一下吗?在github上,Packagist上也没有该软件包。所以我认为这不应该是问题。

我从Gitolite得到的错误:

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

Problem 1
    - The requested package package/package-name 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.

&#34; dev-master&#34;或者&#34;掌握&#34;不工作。

但如果我需要这样的包,它就可以了。

{
  "type": "package",
  "package": {
    "name": "package/package-name",
    "version": "dev",
    "type": "package",
    "source": {
        "url": "git@my-server.com:Library/PackageName",
        "type": "git",
        "reference": "master"
    },
    "require": {
        "php": ">=5.3.2",
        "leafo/scssphp": "^0.3.2"
    },
    "autoload": {
      "psr-0": { "Prefix\\PackageName\\": "src/" }
    }
  }
}

有人知道如何解决这个问题吗?我想用vcs。管理会更容易。谢谢!

我不认为像大多数人一样稳定版本的问题。 Using private Composer VCS Git repo Composer VCS repository not loading dependancies Optimize multiple Composer VCS repository paths

1 个答案:

答案 0 :(得分:0)

如果您想使用分支,则必须在其名称前添加dev-,因此它是dev-master,而不是master

另请注意,您必须明确提及软件所在的所有存储库,否则间接包含将无效。

Composer只知道packagist.org中的包和根composer.json文件中的存储库。包括一个包含你的Gitolite的另一个包的包将不起作用。