deployer icon indicating copy to clipboard operation
deployer copied to clipboard

Clone from private gitlab repo

Open osbulbul opened this issue 9 years ago • 3 comments

Q A
Issue Type Question
Deployer Version 4.2.1
Local Machine OS MacOS Sierra
Remote Machine OS CentOS Linux 7.3.1611

Description

I am trying to use with private repo. Deployer can reach server and create directory structure but can't clone files from private gitlab repo.

Content of deploy.php

<?php
namespace Deployer;
require 'recipe/common.php';

// Configuration

set('ssh_type', 'native');
set('ssh_multiplexing', true);

set('repository', '[email protected]:coderontheroad/**********.git');
set('shared_files', []);
set('shared_dirs', []);
set('writable_dirs', []);

// Servers

server('production', '*.*.*.*')
    ->user('****')
    ->identityFile()
    ->set('deploy_path', '/home/****/****/****');


// Tasks

desc('Restart PHP-FPM service');
task('php-fpm:restart', function () {
    // The user must have rights for restart service
    // /etc/sudoers: username ALL=NOPASSWD:/bin/systemctl restart php-fpm.service
    run('sudo systemctl restart php-fpm.service');
});
after('deploy:symlink', 'php-fpm:restart');

desc('Deploy your project');
task('deploy', [
    'deploy:prepare',
    'deploy:lock',
    'deploy:release',
    'deploy:update_code',
    'deploy:shared',
    'deploy:writable',
    'deploy:vendors',
    'deploy:clear_paths',
    'deploy:symlink',
    'deploy:unlock',
    'cleanup',
    'success'
]);

// [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');

Error

error

osbulbul avatar Feb 23 '17 17:02 osbulbul

@coderontheroad Try to run git clone on the server manually. Did you set a deploy key in the repo and add it on the server?

pluseg avatar Feb 23 '17 20:02 pluseg

@pluseg I already added deploy key but I didn't execute any git clone command. So I tried to execute and it works but i noticed that, server asked add gitlab to (ECDSA) to the list of known hosts. And I said yes. Than deploy comment started to work now :) Thanks...

osbulbul avatar Feb 23 '17 22:02 osbulbul

@pluseg it will be good to add this to docs, ...will help a lot of people.

antonmedv avatar Feb 24 '17 06:02 antonmedv