Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer ignoring auth.json

Even though i have auth.json in my $COMPOSER_HOME and it's loaded, composer still requires me to type credentials on install/update.

This is the output of composer update -vvv that confirms that auth.json has been loaded

Reading ./composer.json
Loading config file /home/user/.config/composer/config.json
Loading config file /home/user/.config/composer/auth.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/var/www/html/api): git branch --no-color --no-abbrev -v
Failed to initialize global composer: Composer could not find the config file: /home/user/.config/composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading /var/www/html/api/vendor/composer/installed.json
Loading plugin PackageVersions\Installer
Running 1.6.3 (2018-01-31 16:28:17) with PHP 7.2.10-0ubuntu0.18.04.1 on Linux / 4.15.0-38-generic
Loading composer repositories with package information
Executing command (/home/user/.cache/composer/vcs/https---private.server.io-private-repo.git/): git rev-parse --git-dir
Executing command (/home/user/.cache/composer/vcs/https---private.server.io-private-repo.git/): git remote -v
Executing command (/home/user/.cache/composer/vcs/https---private.server.io-private-repo.git/): git remote set-url origin 'https://private.server.io/private/repo.git' && git remote update --prune origin
Username for 'https://private.server.io': 

This is my auth.json in /home/user/.config/composer/auth.json:

{
    "http-basic": {
        "private.server.io": {
            "username": "myUsername",
            "password": "myPassword"
        }
    }
}

I copied settings from my old computer where it worked but now it doesn't. I've deleted the auth.json and composer asked me if I want it to remember my credentials, which I said yes, but nothing worked. Any ideas how to get it working?

like image 540
Elwhis Avatar asked Oct 30 '18 08:10

Elwhis


People also ask

What is Auth json?

The auth. json file stores encrypted authentication information for the user to container image registries. The file can have zero to many entries and is created by a login command from a container tool such as podman login , buildah login or skopeo login .

Where do I put composer AUTH json?

In this authentication storage method, an auth. json file will be present in the same folder as the projects' composer. json file. You can either create and edit this file using the command line or manually edit or create it.

Where is Auth json Magento 2?

You can place the auth. json file to the Magento 2 root directory, but I recommend place it to the COMPOSER_HOME directory for security reasons. You need the section only if you have installed Magento 2 from the [GitHub repository](https://github.com/magento/magento2).


2 Answers

This is known behavior in Ubuntu18.04 if you use the same. But if you just hit enter each time it asks for username and password, it will pick them from auth.json and will complete the composer install/update.

like image 192
Ajith Avatar answered Oct 19 '22 03:10

Ajith


yes, pressing enter works. For scripts you can set the environment variable GIT_ASKPASS=echo

like image 45
Иван Виноградов Avatar answered Oct 19 '22 03:10

Иван Виноградов