class Net::SSH::HostKeyError

the remember_host! method on the exception, and then retry.
inspect the key fingerprint and, if you want to proceed anyway, simply call
Base class for host key exceptions. When rescuing this exception, you can

def [](key)

(see also #fingerprint, #host, #port, #ip, and #key).
An accessor for getting at the data that was used to look up the host
def [](key)
  @data && @data[key]
end

def fingerprint

found or did not match.
Returns the fingerprint of the key for the host, which either was not
def fingerprint
  @data && @data[:fingerprint]
end

def host

Returns the host name for the remote host, as reported by the socket.
def host
  @data && @data[:peer] && @data[:peer][:host]
end

def ip

Returns the IP address of the remote host, as reported by the socket.
def ip
  @data && @data[:peer] && @data[:peer][:ip]
end

def key

Returns the key itself, as reported by the remote host.
def key
  @data && @data[:key]
end

def port

Returns the port number for the remote host, as reported by the socket.
def port
  @data && @data[:peer] && @data[:peer][:port]
end

def remember_host!

that subsequent connections will remember them.
Tell Net::SSH to record this host and key in the known hosts file, so
def remember_host!
  @callback.call
end