得到错误“没有找到处理VCS存储库的驱动程序”;在Composer和SVN上


Getting error "No driver found to handle VCS repository" on Composer and SVN

我是新的作曲家,我已经遵循https://getcomposer.org/doc/05-repositories.md#subversion-options结构创建使用作曲家的例子。

然而,当使用命令Composer install时,我得到以下与Composer和SVN的错误消息:

[InvalidArgumentException]
没有找到处理VCS存储库的驱动程序http://myexamplesvn/MyCommon-1.0/.....

这是我的设置:

"repositories": [
    {
        "type": "vcs",
        "url": "http://myexamplesvn/MyCommon-1.0/"
    }
],
"require": {
    "my-common/my-common":"*"
}

你能给我一些想法或建议吗?

我在使用HTTPS地址时遇到了类似的问题:

{
    "type": "vcs",
    "url": "https://github.com:<user>/<repo>"
}

,但使用SSH .git路径为我工作:

{
    "type": "vcs",
    "url": "git@github.com:<user>/<repo>.git"
}

如果你正在使用的repo没有composer.json,那么composer.json的代码像这样可能工作:

"require": {
    "<user>/<repo>": "dev-<branch>"
},
"repositories": [
    {
        "type": "package",
        "package": {
            "name": "<user>/<repo>",
            "version": "dev-<branch>",
            "dist": {
                "url": "https://github.com/<user>/<repo>/archive/<branch>.zip",
                "type": "zip"
            }
        }
    }
]

如果您在本地拉包,请确保

git init 

和提交

这可能有很多不同的可能性,但当您的存储库与ssh私钥/公钥链接时,也会发生这种情况,并且您的私钥不受保护。解决方法是将其设置为600,示例如下:

sudo chmod 600 ~/.ssh/id_rsa

正如我刚刚发现的,这个问题的另一个来源可能只是对目标SVN存储库的访问权限。

我在composer中有以下设置。Json连接到存储库:

"repositories": [
    {
        "type": "vcs",
        "url": "https://host.com/RepositoryName/",
        "trunk-path": "trunk",
        "branches-path": "branches",
        "tags-path": "tags"
    }
],
"http-basic": {
    "host.com": {
        "username": "(username)",
        "password": "(password)"
    }
},
"require": {
    "company/project": "dev-branchname"
},    

问题是http-basic部分中定义的用户没有被授权浏览整个存储库。SVN管理员进行了只允许目标分支访问的限制。

这当然是一个边缘情况,但我相信在尝试搜索更多的外来原因之前,检查存储库的访问权限仍然是一个好主意。