When deploying with Envoyer - it will always fail on the composer install step
Failed to execute git clone --no-checkout '[email protected]:example/example-package.git'
Permission denied (publickey).
fatal: Could not read from remote repository.
I've created an ssh key for the user that Envoyer is using to run this deployment and added that key to the example-package repository. But it still fails with the same message.
What am I missing? There is nothing in the docs about this, and cannot find any solid answers on this anywhere.
I discovered that the ssh key for accessing bitbucket needs to be added to the ssh-agent on the server. But the ssh-agent doesn't load automatically, and the added keys do not persist between ssh requests. So I had to add commands to the .bashrc file to load the ssh-agent and add the ssh key so this would happen on every ssh command request.
These are the commands I added to the top of the .bashrc file:
Note: I had to put these commands at the top of my .bashrc file because there is an if statement at the top that stops evaluating the file if it's not running interactively.