Andrei Herford
Andrei Herford

Reputation: 18729

Composer + local git repo: "could not be found in any version"

I am working on a Symfony project using Composer to manage the dependencies. Some of the required packages are git repos that are located a special server. I can access this Server using Public Key but I cannot give others access to the same server.

Now I would like to let a partner work on the project as well. To let him access the packages they have to be stored on a more public location.

To achieve this I cloned the package repos to my own local machine and tried use them. I changed the 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://[email protected]/commons.git"
    },
    {
        "type": "vcs",
        "url": "ssh://[email protected]/data.git"
    },
]

Changed to:

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

When I try to use composer to install I get the following error:

$ 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.

I double checked the package name and the path and everything is fine. Any idea what might be wrong?

NOTE: I am trying to access/use the local git packages my self. Letting my partner access these packages would be the next step.

Upvotes: 2

Views: 1169

Answers (1)

Pᴇʜ
Pᴇʜ

Reputation: 57683

Remove file:// from the url

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

Upvotes: 3

Related Questions