Skip to content

If a bitbucket repo is listed in repositories with ssh url, authentication will require ssh key #12102

@eiriksm

Description

@eiriksm

My composer.json:

{
  "name": "my-vendor/my-package",
  "repositories": [
    {
      "type": "vcs",
      "url": "git@bitbucket.org:user/test-dep.git"
    }
  ],
  "minimum-stability": "dev",
  "require": {
    "php": ">=5.3.0",
    "user/test-dep": "dev-main"
  }
}

Output of composer diagnose:

Composer could not detect the root package (my-vendor/my-package) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
Checking platform settings: OK
Checking git settings: OK git version 2.45.2
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK does not expire
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: You are not running the latest stable version, run `composer self-update` to update (2.7.8 => 2.7.9)
Checking Composer and its dependencies for vulnerabilities: OK
Composer version: 2.7.8
PHP version: 8.1.29
PHP binary path: /usr/local/bin/php
OpenSSL version: OpenSSL 3.3.1 4 Jun 2024
curl version: 8.8.0 libz 1.3.1 ssl OpenSSL/3.3.1
zip: extension present, unzip present, 7-Zip not available

When I run this command:

composer update -vvv

I get the following output:

Running 2.7.8 (2024-08-22 15:28:36) with PHP 8.1.29 on Linux / 6.8.0-40-generic
Reading ./composer.json (/derp/composer.json)
Loading config file ./composer.json (/derp/composer.json)
Loading config file /derp/auth.json
Reading /derp/auth.json
Checked CA file /etc/pki/tls/certs/ca-bundle.crt does not exist or it is not a file.
Checked directory /etc/pki/tls/certs/ca-bundle.crt does not exist or it is not a directory.
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/derp): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Executing command (/derp): git describe --exact-match --tags
Executing command (CWD): git --version
Executing command (/derp): git log --pretty="%H" -n1 HEAD --no-show-signature
Executing command (/derp): hg branch
Executing command (/derp): fossil branch list
Executing command (/derp): fossil tag list
Executing command (/derp): svn info --xml
Composer could not detect the root package (my-vendor/my-package) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Failed to initialize global composer: Composer could not find the config file: /root/.composer/composer.json

Reading ./composer.lock (/derp/composer.lock)
Loading composer repositories with package information
Executing command (CWD): git clone --mirror -- 'git@bitbucket.org:user/test-dep.git' '/root/.composer/cache/vcs/git-bitbucket.org-user-test-dep.git/'
Executing command (CWD): git --version

In Git.php line 478:
                                                                                                                                                  
  [RuntimeException]                                                                                                                              
  Failed to execute git clone --mirror -- 'git@bitbucket.org:user/test-dep.git' '/root/.composer/cache/vcs/git-bitbucket.org-user-test-dep.git/'  
                                                                                                                                                  
  Cloning into bare repository '/root/.composer/cache/vcs/git-bitbucket.org-user-test-dep.git'...                                                 
  git@bitbucket.org: Permission denied (publickey).                                                                                               
  fatal: Could not read from remote repository.                                                                                                   
                                                                                                                                                  
  Please make sure you have the correct access rights                                                                                             
  and the repository exists.                                                                                                                      
                                                                                                                                                  

Exception trace:
  at phar:///usr/local/bin/composer/src/Composer/Util/Git.php:478
 Composer\Util\Git->throwException() at phar:///usr/local/bin/composer/src/Composer/Util/Git.php:265
 Composer\Util\Git->runCommand() at phar:///usr/local/bin/composer/src/Composer/Util/Git.php:302
 Composer\Util\Git->syncMirror() at phar:///usr/local/bin/composer/src/Composer/Repository/Vcs/GitDriver.php:71
 Composer\Repository\Vcs\GitDriver->initialize() at phar:///usr/local/bin/composer/src/Composer/Repository/VcsRepository.php:144
 Composer\Repository\VcsRepository->getDriver() at phar:///usr/local/bin/composer/src/Composer/Repository/VcsRepository.php:190
 Composer\Repository\VcsRepository->initialize() at phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:308
 Composer\Repository\ArrayRepository->getPackages() at phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:62
 Composer\Repository\ArrayRepository->loadPackages() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/PoolBuilder.php:425
 Composer\DependencyResolver\PoolBuilder->loadPackagesMarkedForLoading() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/PoolBuilder.php:275
 Composer\DependencyResolver\PoolBuilder->buildPool() at phar:///usr/local/bin/composer/src/Composer/Repository/RepositorySet.php:332
 Composer\Repository\RepositorySet->createPool() at phar:///usr/local/bin/composer/src/Composer/Installer.php:501
 Composer\Installer->doUpdate() at phar:///usr/local/bin/composer/src/Composer/Installer.php:298
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:251
 Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:390
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:148
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:93
 require() at /usr/local/bin/composer:29

update [--with WITH] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-dev] [--lock] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [--no-autoloader] [--no-suggest] [--no-progress] [-w|--with-dependencies] [-W|--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-m|--minimal-changes] [-i|--interactive] [--root-reqs] [--] [<packages>...]


And I expected this to happen:

Be able to clone, since I have an app password stored as basic auth for bitbucket.org

If I do the same notation for a VCS repo for gitlab or github, I am able to clone it fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions