Im trying to make Gitlab CI/CD work with some random repository to send all files to remote debian server. My before-script
looks like that:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
As you can see, I’m sending my test private key to debian server with public key in authorized_keys
, but when I run job in pipeline, I get
$ which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
/usr/bin/ssh-agent
$ eval $(ssh-agent -s)
Agent pid 12
$ echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
Enter passphrase for (stdin): ERROR: Job failed: exit code 1
I already tried other keys, making sure I was just hitting return, I overrided passphrase in private key again, pressing return. All other results in SO are for /dev/fd/63
, or are unresolved.