I was trying to set up Magento on AWS EC2 and followed this instruction: https://cloudinfrastructureservices.co.uk/how-to-setup-magento-server-on-azure-aws-gcp/.

I ran this command:

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

It's supposed that I would be asked for username and password, which are my public key and private key. However, this was what came up to me:

enter image description here

What does it mean and how should I fix it?


1 Answer 1


To resolve this issue, create the auth.json file within the root directory of your Magento 2 installation with authentication keys for the Magento 2 repository.

To create the authentication keys, refer to the official document (previously Devdocs) as mentioned in the error message: https://experienceleague.adobe.com/docs/commerce-operations/installation-guide/prerequisites/authentication-keys.html

To create authentication keys:

  1. Log in to the Commerce Marketplace. If you don’t have an account, click Register.

  2. Click your account name in the top right of the page and select My Profile.

  3. Click Access Keys in the Marketplace tab. enter image description here

  4. Click Create a New Access Key. Enter a specific name for the keys (for example, the name of the developer receiving the keys) and click OK.

  5. New public and private keys are now associated with your account that you can click to copy. Save this information or keep the page open when working with your project. Use the Public key as your username and the Private key as your password.

After obtaining your authentication keys, create the auth.json file within the root directory of your Magento 2 installation with the following content:

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

You now can proceed with setting up your Magento 2 project.

Additionally, to avoid permissions issues, it is recommended not to use sudo in the composer command when installing Magento.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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