vendredi 11 janvier 2019

Net-SSH/Capistrano problem: "Could not parse PKey: no start line"

For years I've been deploying my Rails 3.2.13 app successfully using Capistrano. But just today I ran into the dreaded ArgumentError: Could not parse PKey: no start line when connecting to the server.

From other posts I gather this is actually an issue with the net-ssh gem, which Capistrano uses to make the connection. Apparently older versions of net-ssh aren't compatible with the key files created by more recent versions of OpenSSH. (See here and here for example.)

This diagnosis is confirmed by the following little irb session:

irb(main):006:0> require 'net/ssh'
=> false
irb(main):007:0> Net::SSH::KeyFactory.load_private_key('~/.ssh/id_rsa')
ArgumentError: Could not parse PKey: no start line

I guess I updated my private key file recently when I changed my password, and now it's incompatible with my version of net-ssh (v2.7.0).

I can't upgrade net-ssh since I'm stuck with Ruby 1.9.3.

Is there maybe a way to get back to an old/compatible version of the private key file? Or some other solution perhaps?

Aucun commentaire:

Enregistrer un commentaire