Avoid `ssh-add` passphrase prompt

Dear group,

I need some help.

I have a private git repository and I’m tryining to implement Travis.

My requirements are to do the build of SSR React Project and then deploy to VPS by shh, I just did it before using Gitlab CI but with Travis I have some issue.

language: node_js
node_js:
  - 14

before_install:
  - echo $SSH_PRIVATE_KEY
  - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
  - eval $(ssh-agent -s)
  - ssh-add <(echo "$SSH_PRIVATE_KEY")
  - mkdir -p ~/.ssh
  - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'

install:
  - npm install`

But on the job log I receive this:

$ echo $SSH_PRIVATE_KEY

-----BEGIN

before_install.22170.01s

$ which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )218/usr/bin/ssh-agentbefore_install.32190.01s

$ eval $(ssh-agent -s)

$ ssh-add <(echo "$SSH_PRIVATE_KEY")

Enter passphrase for /dev/fd/63:

How can I solve, what I was wrong?

Thanks

Looks like this private key has passphrase. Is that true? Then you can try:

  1. Remove the passphrase

  2. Send passphrase with echo:

     echo ${SSH_PASSPHRASE} | ssh-add <(echo ${SSH_PRIVATE_KEY})