Trying to upload jar via scp using ssh key

ssh
deployment

#1

In the project settings I added ssh key with hostname “cheerry”.
config.yml looks like this:

  - run: echo 'cheerry.ru,92.53.105.57 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDrY4KPUUh7CY47l/S4TNTcir0Ovfa3JeyjVtpNb97+O0qQwbwF9KCIwauy5/7CbVMLz3FbfC80Sf1+8nabwhcI=
        ' >> ~/.ssh/known_hosts

  - restore_cache:
      keys:
      - v1-dependencies-{{ checksum "build.sbt" }}
      - v1-dependencies-

  - run: sbt assembly
  - run: scp -i ~/.ssh/id_cheerry /home/circleci/repo/target/scala-2.11/calcaserver.jar valik@cheerry.ru:/home/valik/calcaServer/ciBuilds

  - save_cache:
      paths:
        - ~/.m2
      key: v1-dependencies--{{ checksum "build.sbt" }}

When building got this error:

#!/bin/bash -eo pipefail
scp -i ~/.ssh/id_cheerry /home/circleci/repo/target/scala-2.11/calcaserver.jar valik@cheerry.ru:/home/valik/calcaServer/ciBuilds
Warning: Identity file /home/circleci/.ssh/id_cheerry not accessible: No such file or directory.
valik@cheerry.ru’s password:

In the documentation:

The ssh private keys that you add from the page are stored under the ~/.ssh directory for the build user in the container. We also add entries to ~/.ssh/config to specify which key is used to access which host. For example, if you add a key with the hostname prod-server, then ~/.ssh/id_prod-server will be automatically created

What am I doing wrong?


#2

Fixed it by adding this in config.yml:

- add_ssh_k`Preformatted text`eys:
      fingerprints:
        - "<finger print from SSH Permissions in project settings>".

Then you can use scp without password:

- deploy:
          command: |
            chmod 600 ~/.ssh/id_*
            echo 'cheerry.ru,92.53.105.57 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDrY4KPUUh7CY47l/S4TNTcir0Ovfa3JeyjVtpNb97+O0qQwbwF9KCIwauy5/7CbVMLz3FbfC80Sf1+8nabwhcI=
                        ' >> ~/.ssh/known_hosts
            scp -r /home/circleci/repo/ciBuilds valik@cheerry.ru:/home/valik/calcaServer

#3