I am writing a shell script in bash (rewriting) that migrates / deploys our magento2 marketplace.

I started off by getting the latest release from github, but that makes it so i cannot use the admin-based web updater (which is the only place I can install our payment processor module because they don't upload to packagist) I don't want to attempt a sed edit on the package.json to add the repo and access keys, so I'm left trying to use the following command:

composer create-project --repository=https://repo.magento.com/ magento/project-community-edition

Of course, this requires I manually enter the access keys. i attempted to script it like this:

echo "a2dthisisnotreale1621a522a 21e9thisisnotreald4a183373" | composer create-project --repository=https://repo.magento.com/ magento/project-community-edition /var/www

I get an error stating You must be using the interactive console to authenticate. How am I supposed to do an unattended deploy? Our shop focuses primarily on continuous integration, and i cannot have our site be down for more than 20 minutes or so. It seems like every example of installing magento2 is from a non-automated method.

Has anyone tackled this problem? If so, how did you do it?


As usual, immediately after asking the question, i figure out the answer.

I need to add a file ~/.composer/auth.json with the following:

    "http-basic": {
        "repo.magento.com": {
            "username":"<your public key>",
            "password":"<your private key>"

Then I need to ensure that i create the folder, chown it to the user executing composer, and execute the command.


Another option is to set the access keys using the composer config command just before running the composer create-project command

composer config -g http-basic.repo.magento.com $MAGENTO_PUBLIC_KEY $MAGENTO_PRIVATE_KEY
composer create-project --repository=https://repo.magento.com/ magento/project-community-edition:2.3.* $PATH_TO_MAGENTO_ROOT

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.