Trying to install magento 2 on localhost. I am getting this message

Invalid credentials for 'repo.magento.com/packages.json', aborting.

Initially, I had created a secure key by navigating to magentocommerce.com/magento-connect/customerdata/secureKeys/list/ url.

I tried composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition <installation directory name> command and entered the username as public key and password as private key. I was then prompted whether I need to save it? And I selected the option "Y".

But by some mistake the secure key got deleted.

Now, when I am trying to create a new project, its giving me

Invalid credentials for 'https://repo.magento.com/packages.json', aborting.

I want to update my auth.json file . But I'm unable to get the command. Can you please help me for the same?

  • Did you solve your issue?
    – Gem
    May 2, 2018 at 9:28

1 Answer 1


Use your public key as username and private key as password from your magento connect account

you can find the public and private key at:


Developer Portal -> My Access Keys -> Create A New Access Key(Or using exsting key)

  • 2
    works, magento is weird May 26, 2017 at 0:15
  • Is it working on localhost upgrade?
    – Gem
    May 2, 2018 at 9:27
  • 1
    @Gem yes its working! and perfect answer! made my day! +1 Mar 12, 2019 at 12:29
  • @Prince i have same issue but not working for me (prntscr.com/mzww21) Mar 19, 2019 at 10:38
  • 1
    yes but still same issue facing i have also create auth.json file Mar 19, 2019 at 10:47

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