Ant scp task: JSchException: invalid privatekey [duplicate]
问题 This question already has answers here : “Invalid privatekey” when using JSch (3 answers) Closed 10 months ago . I created a new key pair using ssh-keygen and added the public key on the server. Using sftp -i private_key_file user@server I can successfully open a connection to the server and put files. However, when I try to use the Ant scp task I receive: com.jcraft.jsch.JSchException: invalid privatekey: [B@5e9d5728 The relevant part of the Ant script: <scp file="local-file.zip" trust="true