Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 483
Thomas Boel Micheelsen Avatar asked Aug 09 '18 13:08

Thomas Boel Micheelsen


1 Answers

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).

like image 164
Viktor Benei Avatar answered Nov 16 '22 16:11

Viktor Benei