Why does host key verification fail? Symfony and BitBucket Deployment with Easy-Deploy-Bundle

  bitbucket, git, php, ssh, symfony

I am trying to deploy my Symfony 5 application via BitBucket Pipelines and easy-corp/easy-deploy-bundle to my server. I’ve followed the instructions on https://support.atlassian.com/bitbucket-cloud/docs/use-ssh-keys-in-bitbucket-pipelines/ to create an ssh key and added my server as a known host within BitBucket. I also followed the instructions at https://github.com/EasyCorp/easy-deploy-bundle/.

The error I get within the pipeline when running php bin/console deploy -v is:

[...] Executing command: echo 1234353400
| err :: Host key verification failed.
In Process.php line 252:
  The command "ssh ... -p ... 'echo 1234353400'" failed.  
  Exit Code: 255(Unknown error)                                                
  Working directory: /opt/atlassian/pipelines/agent/build                      
  Error Output:                                                                
  Host key verification failed.                                                

I’ve added the public key from Symfony to the file ~/.ssh/authorized_keyson my server.

My config file for deployment (deploy.php) looks as follows:


use EasyCorpBundleEasyDeployBundleDeployerDefaultDeployer;

return new class extends DefaultDeployer
    public function configure()
        return $this->getConfigBuilder()
            ->server('[email protected]:port')

Where user, host, port, dir, and ssh-url are replaced by my credentials, which work fine when accessing the server via ssh in the terminal.

So what am I doing wrong? Is easy-deploy-bundle accessing the valid .ssh directory, where BitBucket stores my key and known host?

I found that StrictHostKeyChecking=no could be a possible solution, but I didn’t found how to disable it within easy-deploy-bundle.

Thanks for your help.

Source: Symfony Questions