php – Authentication required (packagist.org) Laravel installation-ThrowExceptions

Exception or error:

I’m using Ubuntu 16.04 and trying to install Laravel (any version). Actually I cloned from GitHub the Laravel project (https://github.com/laravel/laravel) After cloning I’m running the command as below:

root:/var/www/html/laravel$ composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Authentication required (packagist.org): 
  Username: 

This is the issue I’m facing, I don’t know what username I have to give, and why its asking authentication.. And if I run composer diagnose I get this output:

composer diagnose
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: Authentication required    (packagist.org):
  Username:

Any suggestions or can anyone tell what was I’m missing here?

How to solve:

run composer config --global repo.packagist composer https://packagist.org and then try again. This should prevent it from using http protocol and force https which might fix it in case you have a bad proxy in the way.

Answer´╝Ü

In my case, solved the issue as below:

$ composer diagnose

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
Checking composer version: WARNING
You are not running the latest stable version, run `composer self-update` to update (1.6.3 => 1.7.2)
Composer version: 1.6.3
PHP version: 7.2.8
PHP binary path: /usr/local/Cellar/php/7.2.8/bin/php

The I ran

$ composer self-update --update-keys

Open https://composer.github.io/pubkeys.html to find the latest keys
Enter Dev / Snapshot Public Key (including lines with -----): 
[copy and paste the dev pub key]

Enter Tags Public Key (including lines with -----):
[copy and paste the tags pub key]

Then again, I ran

$ composer self-update

However, during installing the package, it still shows:

Authentication required (repo.packagist.org):
  Username:

After providing my username and password for my packagist.org account and having my credential stored in /Users/xxx/.composer/auth.json, the issue was resolved.

Leave a Reply

Your email address will not be published. Required fields are marked *