0

The before_scriptin my .gitlab-ci.yml file stops while waiting for a password phrase.

  • I already added the private ssh key as an environment variable
  • I added the public key on the server
  • I do not need a passphrase when connecting to the server via ssh

Here is my script i use:

image: docker:git

before_script:
  - '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

I get the following prompt: "Enter passphrase for (stdin):"

enter image description here

Since the private key does not have any passphrase I assume the ssh-agent asks me if I want to add a new passphrase to my private key. How can I forward this prompt without providing any passphrase?

thiloilg
  • 1,733
  • 2
  • 18
  • 23
  • 2
    According to the [ssh-add source code](https://github.com/openssh/openssh-portable/blob/master/ssh-add.c#L232), it prompts for a passphrase if it can't parse the key without one. If the key isn't supposed to have a passphrase, you may be feeding it a corrupt key value. – Kenster Jul 22 '19 at 16:59
  • 1
    Kenster - your comment seems like an answer. Can you provide it as an answer? – Drew Blessing Jul 22 '19 at 19:00

0 Answers0