deployphp / deployer

The PHP deployment tool with support for popular frameworks out of the box
https://deployer.org
MIT License
10.59k stars 1.48k forks source link

Not ask for credentials for private repository during composer install #725

Closed cve closed 8 years ago

cve commented 8 years ago
Q A
Issue Type Question
Deployer Version 3.2
Local Machine OS Debian 8.4
Remote Machine OS N/A

Description

I have a private repository on the bitbucket which is Symfony bundle and localy when I run composer update it ask me about password, because entry in my composer.json is similar to (please not about https instead of ssh.):

"repositories": [
        {
            "type": "vcs",
            "url":  "https://me@bitbucket.org/me/some-bundle.git"
        }
    ],

But when I deploy my app the task of deploy:vendors throws:

[RuntimeException]                                                                                                                          
  Loading composer repositories with package information                                                                                      

    [RuntimeException]                                                                                                                        

    Failed to execute git clone --mirror 'https://me@bitbucket.org/me/some-bundle.git' '/home/acropol/  
  .composer/cache/vcs/https---me-bitbucket.org-me-some-bundle.git/'                                     
    Cloning into bare repository '/home/app/.composer/cache/vcs/https---me-bitbucket.org-me-permission-b  
  undle.git'...                                                                                                                               
    remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your a  
  ccount profile.                                                                                                                             
    fatal: Authentication failed for 'https://me@bitbucket.org/me/some-bundle.git/'                     

  install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-p  
  rogress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<pac  
  kages>]...   

Is there any option to tell deployer to ask for credentials during deploy?

Content of deploy.php

<?php

// All Deployer recipes are based on `recipe/common.php`.
require __DIR__.'/vendor/deployer/deployer/recipe/symfony3.php';

// dev server
server('dev', 'host.example.com', 18080)
    ->user('username')
    ->identityFile()
    ->stage('dev')
    ->env('deploy_path', '/var/www/html/myapp/dev')
    ->env('branch', 'develop')
    ->env('env_vars', 'SYMFONY_ENV=dev')
    ->env('env', 'dev')
    ->env('composer_options', 'install')
;

// override from symfony recipe
task('deploy:clear_controllers', function () {})->setPrivate();

set('shared_dirs', ['var/logs', 'var/sessions', 'app/var']);
set('writable_dirs', ['var/cache', 'var/logs', 'var/sessions', 'app/var']);

set('repository', 'ssh://git@my.com/repo.git');

after('deploy:vendors', 'database:migrate');
oanhnn commented 8 years ago

Please using public key instead enter password.