作曲家 + 本地 git 存储库:"could not be found in any version"



我正在处理一个Symfony项目,使用Composer来管理依赖关系。一些必需的软件包是位于特殊服务器上的git-reso。我可以使用公钥访问此服务器,但不能授予其他人访问同一服务器的权限。

现在我想让一个合作伙伴也参与这个项目。为了让他能拿到包裹,它们必须存放在一个更公开的地方。

为了实现这一点,我将软件包repos克隆到自己的本地机器上,并尝试使用它们。我更改了composer.json:

...
"require": {
    ...
    "mycompany/commons":"dev-master",
    "mycompany/data":"dev-master",
    ...
},  
...
"minimum-stability": "stable",
"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "branch-alias": {
        "dev-master": "1.8-dev"
    }
},
"repositories": [
    {
        "type": "vcs",
        "url": "ssh://git@my-restricted-server.x/commons.git"
    },
    {
        "type": "vcs",
        "url": "ssh://git@my-restricted-server.x/data.git"
    },
]

更改为:

"repositories": [
    {
        "type": "vcs",
        "url": "file://absolut/path/to/commons/.git"
    },
    {
        "type": "vcs",
        "url": "file://absolut/path/to/data/.git"
    },
]

当我尝试使用composer来安装时,我得到以下错误:

$ composer install --no-dev --optimize-autoloader
Loading composer repositories with package information
Installing dependencies                                          
Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - The requested package mycompany/commons could not be found in any version, there may be a typo in the package name.
  Problem 2
    - The requested package mycompany/data 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://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

我仔细检查了包名和路径,一切都很好。知道可能出了什么问题吗?

注意:我正在尝试自己访问/使用本地git包。下一步是让我的合作伙伴访问这些软件包。

url 中删除file://

"repositories": [
    {
        "type": "vcs",
        "url": "absolut/path/to/commons/.git"
    },
    {
        "type": "vcs",
        "url": "absolut/path/to/data/.git"
    },
]

相关内容

最新更新