IanWatson
IanWatson

Reputation: 1739

Jenkins publish over SSH error

I'm expericing the following error when trying to use the Publish Over SSH plugin to jenkins when using a different key.

jenkins.plugins.publish_over.BapPublisherException: Failed to add SSH key. Message [invalid privatekey: TheKey]

I've tried different alternatives of using the path to key and the key field itself.

Has anyone experienced / solved this issue?

Upvotes: 1

Views: 6382

Answers (3)

Rohan J Mohite
Rohan J Mohite

Reputation: 2613

If someone came across this type of error.

Jenkins "Publish Over SSH plugin" accept private key in OpenSSH format format.

Please use below steps, to convert private key in OpenSSH format. Using Putty gen.

  1. Open PuttyGen
  2. Click Load
  3. Load your private key (Enter passphrase if required)
  4. Go to Conversions->Export OpenSSH and export your private key

Copy and paste the private key into the Key section of Jenkins SSH Server. Enter Passphrase.

Click on "Test Configuration" button, "Success" :)

Upvotes: 5

VSK
VSK

Reputation: 469

Since you are using a different key, you will have a public and private key pair. The public key has to be added to the target server autorized_keys file with in the <$HOME user>/.ssh/ and the private key has to configured in the Jenkins either using the path to key and the key field itself.

Upvotes: 0

Bruno Lavit
Bruno Lavit

Reputation: 10382

In your path (to the key), do you have both public and private keys in this folder?

I think It's mandatory when you pair 2 machines.

Upvotes: 0

Related Questions