Hi all,
I’ve just started using CircleCI to deploy code for me for personal projects. I have managed to get my config to deploy when using the circleci local execute
cli but pushing it it always falls. I have tweaked the config as below to use the projects SSH key.
I generated a new SSH key and uploaded to the " Additional SSH Keys" section. When uploading the key I set the hostname to “my-server.net” (changed for obvious reasons). I then used the fingerprint that the web page showed and added to the config. I can log into the sever I need to using the key in question.
When running after a push it gets stuck at:
The authenticity of host ‘my-server(123.123.123.123)’ can’t be established.
ECDSA key fingerprint is SHA256_VALUE.
Are you sure you want to continue connecting (yes/no)?
I then stop the job and then re-start allows SSH access to the run.
When I try to ssh in from within CircleCI I get the error:
username@my-server: Permission denied (publickey).
Can anyone suggest what I’m doing wrong?
version: 2.0
jobs:
build:
docker:
- image: cimg/base:2020.01
steps:
- checkout
- add_ssh_keys:
fingerprints:
- "my key fingerprint"
- run:
name: "Create build"
command: tar -czvf /tmp/build.tar.gz .
- run:
name: "Upload to remote server"
command: scp /tmp/build.tar.gz username@my-server:~/
- run:
name: "Install build"
command: |
ssh username@my-servertar -xvf build.tar.gz -C /var/www/vhosts/my-server/
ssh username@my-server"cd /var/www/vhosts/my-server/ && composer install"
- run:
name: "Reload NGINX"
command: ssh my-serversudo service nginx reload