Trying to trigger a deployment generates the following error:

------------------------- Wed Jan 25 2023 21:22:20 GMT+0000 (Coordinated Universal Time)
Build started for landing
Build has failed!
----------------------
Deploy failed!
Error: Cloning into '/captain/temp/image_raw/landing/14/source_files'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

NOTE: Test that the deployment hook is set and working ok. You do that from the Code and automation > Webhooks section in your repository's settings.

Following the GitHub guide to regenerate keys we modify the command to not require a password:

$ ssh-keygen -t ed25519 -C "user@example.com" -f ./ops/certs/caprover_deploy -q -N ""

This command will create a caprover_deploy and caprover_deploy.pub in the ./ops/certs directory. Copy the private key into CapRover section with the textbox for SSH keys, make sure there key ends with an empty line. Then add the public key to the GitHub repository deploy keys section.

From your CapRover server machine, run the command to clear docker keys:

$ docker service update --force captain-captain
captain-captain
overall progress: 1 out of 1 tasks
1/1: running
verify: Service converged
$ ssh-keygen -R github.com

From the CapRover machine test that they key works, copy the private key to a temp:

nano /tmp/test_github

After pasting, then we change the permissions

chmod 400 /tmp/test_github

Now we can try the key:

ssh -T git@github.com -i /tmp/test_github
Hi goliatone/goliat.one! You've successfully authenticated, but GitHub does not provide shell access.

Remove the key after testing.


Resources