Hello,
I’m new to CircleCI and setting up the environment. I have investigated on how to deploy to a remote server using SCP and I was able to set up everything according to the tutorials.
I have added a private SSH key to my project;
I have added the public key to my remote server;
I have tested the command on my computer and it works correctly;
And I have configured the config.yml file accordingly.
However when the process starts, I get the following error when it gets to the SCP command:
ssh: connect to host ******************* port 22: Network is unreachable
lost connection
Exited with code exit status 1
Here is my configuration file:
version: 2
jobs:
build:
machine:
enabled: true
working_directory: ~/repo
steps:
- checkout
- add_ssh_keys:
fingerprints:
- 'd4:e1:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX'
- run:
name: Deploy Over SSH
command: |
if [ "${CIRCLE_BRANCH}" = "master" ]; then
scp -r * <user>@<host>:<path>
else
echo "Not master branch, do nothing"
fi
workflows:
version: 2
build:
jobs:
- build:
filters:
branches:
only: master
I would really appreciate some help with this.
Thanks!