I have a problem with deployer that is driving me crazy! In some of my projects I get the following error message:
[Deployer\Exception\RuntimeException (128)]
The command "cd /home/www/p123456/html/myproject/beta && (/usr/local/bin/git clone -b "develop" --recursive git@github.com:Starraider/myProject.git /home/www/p123456/html/myproject/beta/releases/4 2>&1)" failed.
Cloning into '/home/www/p123456/html/myproject/beta/releases/4'...
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
This means that Git cannot clone the repository down to the server because it has no rights to do so. Of course the respective repository exists, but it is "private" (because it is a customer project) and therefore needs a deployment key. Of course, I had previously created a corresponding SSH key on the server with ssh-keygen -t rsa -b 4096
and entered the public key at GitHub as a deployment key. A test connection with ssh -i ~/.ssh/id_rsa -T git@github.com
works fine and also "by hand" the repository can be cloned to the server without any problems.
With deployer, however, it doesn't work, although the script doesn't do anything different than I did by hand either!
And the crazy thing is that with the same script and the same settings etc. it works for some projects on the same server, but for some of them it doesn't work. But then every time I log into the server with SSH and try to clone the repository "by hand" it works fine. But again with the script it still doesn't work.
I just don't understand how it can be that the command /usr/local/bin/git clone -b "develop" --recursive git@github.com:Starraider/myProject.git
works by hand, but at the same time doesn't work via deployment script. This is beyond my comprehension!
In the meantime, I have spent several days troubleshooting and tried countless configurations, program versions, etc., but to no success. Even the support of my provider couldn't help me, because it would be too much work for them to rebuild the whole system with private GitHub repository and deployment script etc. to find the problem.
So my hope is that one of you might have an idea what the problem could be!!! I would be very grateful for any tips!
I use deployer v6.8.0, git v2.36.0, PHP v7.4.30 and sourcebroker/deployer-extended-typo3 v18.1.0 to deploy TYPO3 v11 and my deploy.php looks like this:
<?php
namespace Deployer;
require_once(__DIR__ . '/vendor/sourcebroker/deployer-loader/autoload.php');
new \SourceBroker\DeployerExtendedTypo3\Loader();
set('repository', 'git@github.com:Starraider/myProject.git');
set('web_path', 'public/');
set('shared_files', ['.env']);
set('shared_dirs', function () {
return [
get('web_path') . 'fileadmin',
get('web_path') . 'uploads',
get('web_path') . 'typo3temp/assets/_processed_',
get('web_path') . 'typo3temp/assets/images',
!empty(get('web_path')) ? 'var/log' : 'typo3temp/var/log',
!empty(get('web_path')) ? 'var/transient' : 'typo3temp/var/transient',
];
});
host('beta')
->hostname('p123456.mittwaldserver.info')
->user('myusername')
->set('branch', 'develop')
->addSshOption('StrictHostKeyChecking', 'no')
->set('writable_mode', 'chmod')
->set('default_timeout', '600')
->set('keep_releases', '4')
->set('fetch_method', 'curl')
->set('public_urls', ['https://beta.myproject.de'])
->set('deploy_path', '/home/www/p123456/html/myproject/beta');
The ssh config file on my server looks like this:
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile /home/www/p123456/.ssh/id_rsa
StrictHostKeyChecking no
CU... Sven