Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save x3rAx/d117715e6b870dbd2726b75d22d1a696 to your computer and use it in GitHub Desktop.
Save x3rAx/d117715e6b870dbd2726b75d22d1a696 to your computer and use it in GitHub Desktop.
Generate ssh key-pair for Bamboo (when Bamboo uses a stupid Java implementation of git)

The Problem

Bamboo (at least the instance I have to work with) is using a Java implementation of git (JGit) that has problems reading the new SSH key-file format.

In earlier versions, ssh-keygen generated private keys that looked like:

-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----

In recent versions, the key looks like this:

-----BEGIN OPENSSH PRIVATE KEY-----
...
-----END OPENSSH PRIVATE KEY-----

JGit (at least in the version mentioned above) does not understand this new key format and responds with an error similar to:

[email protected]:cplgmbh/cpl-vm.git: invalid privatekey: [B@59c40796

The Solution (or Workaround)

Generate the ssh key-pair with the -m PEM option:

ssh-keygen -m PEM -o -a 100 -t RSA -f fookey

And BTW: Upgrade your SSH keys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment