Andrzej Piszczek
Andrzej Piszczek

Reputation: 369

Composer asks only for password with private repository

When I use a private repository like below in my composer.json

  "repositories": [
    {
      "url": "ssh://repo.com/porject",
      "type": "git"
    }
  ],

Composer install/update doesn't ask me for my username, it gets the name of the current user of my computer and uses it automatically. It prompts me only for a password.

ask only about password img

Any idea how to set it correctly and how I can store the auth once typed in?

Upvotes: 0

Views: 2921

Answers (1)

Pᴇʜ
Pᴇʜ

Reputation: 57683

Try to config access via SSH keys or specify your desired username like below. For more information see the Composer docs.

{
    "repositories": [
        {
            "type": "composer",
            "url": "ssh2.sftp://example.org",
            "options": {
                "ssh2": {
                    "username": "composer",
                    "pubkey_file": "/home/composer/.ssh/id_rsa.pub",
                    "privkey_file": "/home/composer/.ssh/id_rsa"
                }
            }
        }
    ]
}

Upvotes: 2

Related Questions