首页 > 解决方案 > 作曲家忽略 auth.json

问题描述

即使我的 $COMPOSER_HOME 中有 auth.json 并且它已加载,作曲家仍然要求我在安装/更新时输入凭据。

这是composer update -vvv确认 auth.json 已加载的输出

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': 

这是我在 /home/user/.config/composer/auth.json 中的 auth.json:

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

我从旧电脑上复制了设置,但现在不行了。我已经删除了 auth.json 并且作曲家问我是否希望它记住我的凭据,我说是的,但没有任何效果。任何想法如何让它工作?

标签: authenticationcomposer-php

解决方案


如果您使用相同的,这是 Ubuntu18.04 中的已知行为。但是,如果您只是在enter每次询问用户名和密码时点击,它将从 auth.json 中选择它们并完成作曲家安装/更新。


推荐阅读