Zlatan Omerovic
Zlatan Omerovic

Reputation: 4097

Unable to composer install/require from a private GitLab repo (namespace)

I am having problems installing a private composer library from a private GitLab repo.

My private library which I want to use has this in it's composer.json and is stored on my GitLab:

{
    "name": "zlatan/app-client",
    "type": "library",
    "license": "MIT",
    "description": "Client in PHP",
    "authors": [
        {
            "name": "Zlatan Omerovic",
            "email": "[email protected]"
        }
    ],
    "require": {
        "symfony/http-client": "^4.3"
    },
    "autoload": {
        "psr-4": {
            "AppClient\\": "src/"
        }
    }
}

My Git path to my library is: /namespace/project/app-client.git, i.e.

[email protected]:namespace/project/app-client.git

And now I'd like to use that library which I have named zlatan/app-client, in another composer.json file:

{
    "name": "zlatan/composer",
    "authors": [
        {
            "name": "Zlatan Omerovic",
            "email": "[email protected]"
        }
    ],
    "require": {
        "zlatan/app-client": "master"
    },
    "repositories": [
        {
            "type": "git",
            "url": "[email protected]:namespace/project/app-client.git"
        }
    ]
}

Now, when I run composer install, I always get this output:

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

  Problem 1
    - The requested package zlatan/app-client 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.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

My first and only guess is that these GitLab namespaces / prefixes in the URI are making a problem?

Is it possible to resolve this?

Upvotes: 0

Views: 205

Answers (2)

Ghassan Mg
Ghassan Mg

Reputation: 1

Try to use proxy or vpn app when you want to use composer install command

Upvotes: 0

Edi Modrić
Edi Modrić

Reputation: 2310

Try using dev-master to reference to your master branch.

Using master will instruct Composer to search for a tag named master and if that does not exist, it will fail.

Additionally, you can try adding "minimum-stability": "dev" to your composer.json to make sure development versions of packages can be installed.

Upvotes: 1

Related Questions