Install composer package from private gitlab

Published 6 months ago by EmilMoe

I have been struggling a bit getting it to work to delegate some of my features to a private gitlab repo. I am not sure how I should configure it in my composer.json.

Seems like I'm messing something up with a token or ssh key. As far as I can tell it would be easiest with at token, when I am going to distribute the code to several servers?


Well best practice for Gitlab is using a deploy ssh key for this kind of stuff.



Thanks. I know about ssh keys and deploy keys, but what I don't know about is the configuration in composer


Aah oke I get you now! Well you can use the basic-auth functionality from composer:

There is also a command-line version of this call

composer config --auth $USERNAME $PASSWORD --no-ansi --no-interaction

It basically adds everything to an auth.json file in the ~/.composer directory. You only need to add this once on your server ;) If you use something like docker, it's recommended to use the command line version.

Please sign in or create an account to participate in this conversation.