Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Composer install package via VCS such as GitLab (Private package requirement)

Composer install package via VCS such as GitLab

(Private package requirement)

1. Create composer.json:

{
    "repositories": [                                             
        {                                                         
            "type": "vcs",                                        
            "url": "git@gitlab.com:name/lib-name.git"
        }                                                         
    ]
}

After that, the Composer could install packages via Packagist and your VCS.


2. Composer Install

First, check the current user has the ssh-key permission to access VCS git-ssh repositories.

Then run Composer require for VCS git package with --no-interaction:

composer -n require name/lib-name

--no-interaction would skip auth.json for VCS repositories such as GitLab API, and use giving url to access instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment