Failed to add the SSH key to the ssh-agent with an empty passphrase (Bitrise CLI)
Asked Answered
C

1

6

Summary:

As I'm integrating CI to the development workflow, I'm also trying to move the executions of Bitrise workflows to our local iOS Mac Computer which is setup as a Jenkins slave. The projects that I'm trying to build therefore needs to be built on this iOS Computer.

Problem:

I'm trying to establish an ssh connection to an integration user (a GitHub account that has access to my repositories) and I have created a key and added it to the GitHub user as well as to the .bitrise.secrets.yml file.

But when the initial step, the activate-ssh-key step is executed, it results with an error that I can't add the SSH key to the ssh-agent with empty passphrase. (Is this somehow configurable? Can I just evade this?)

Here is the output log: https://pastebin.com/FCHhZNDb

Step in bitrise.yml:

- [email protected]: {getenv "SSH_RSA_PRIVATE_KEY"}

.bitrise.secrets.yml:

envs:
- SSH_RSA_PRIVATE_KEY: ssh-rsa *KEY*

|------------------------------------|

I have also tried putting the ssh key directly in the .ssh directory which did not work.

Any help is really appreciated! :)

TL;DR

Trying to connect bitrise cli with github via ssh, doesn't work.

Cymatium answered 9/8, 2018 at 13:34 Comment(0)
V
6

The SSH key you used seem to be protected with a passphrase. You should generate one that does not require a passphrase to be specified, and register that for the repository.

How to generate such an SSH key: https://devcenter.bitrise.io/faq/how-to-generate-ssh-keypair/

ssh-keygen -t rsa -b 4096 -P '' -f ./bitrise-ssh -m PEM

Alternatively you can replace the Activate SSH Key step with a script one and activate the SSH key any way you like.

Or if you prefer to not to use SSH keys you could switch to using https:// git clone urls (instead of the SSH / git@ one) and replace the Activate SSH Key step with the Authenticate with GitHub OAuth one (https://www.bitrise.io/integrations/steps/authenticate-with-github-oauth).

Vikkivikky answered 10/8, 2018 at 16:2 Comment(2)
I used this command, but the build still fails with the same errorAmbit
@SamuelDebruyn I edited my answer, in macOS Mojave the default "method" changed and so if you want to use the previous default (PEM) you have to specify that in the command (-m PEM). We also updated the linked devcenter page.Vikkivikky

© 2022 - 2024 — McMap. All rights reserved.