JSchException – invalid privatekey – ant – scp

2 Feb

Trying to use scp target in ant with a ‘keyfile’, i had previously used puttygen to make myself a key (and it worked fine through putty).

With Ant i was getting:

$> build.xml:21: com.jcraft.jsch.JSchException: invalid privatekey: C:\id_rsa.ppk

Solution:
Load up puttygen and “Export” the key in ‘openssh’ format. Try using this key instead.

Advertisements

9 Responses to “JSchException – invalid privatekey – ant – scp”

  1. Larry Kriv March 7, 2007 at 5:17 am #

    I had this error in Ant 1.7.0. I found you thread through a Google search. I tried your solution and it worked perfectly. Thanks.

  2. Pierre I August 29, 2007 at 6:39 pm #

    I googled my problem and got 1 hit: this page. And it solved my problem!!

    Thank you!!

  3. Richard Hart October 28, 2008 at 11:43 pm #

    Wow! Worked a charm. Thanks.

  4. mike July 27, 2011 at 5:13 pm #

    Worked Very well Thanks.

  5. Guest August 9, 2011 at 8:01 am #

    Thx for this greate Tip! Save me a lot of Googletime 😉

  6. Durga Chintaluri September 12, 2011 at 4:02 pm #

    It worked ..thanks for the input. very much appreciated.

  7. Udeshika Dilrukshi June 13, 2012 at 3:32 am #

    It works.Thanks it’s great

  8. Lionel BERTIN August 31, 2012 at 7:50 am #

    Fencing that problem using jEdit SFTP plugin, it also worked for me.
    Thanks

  9. kavin May 30, 2013 at 7:20 am #

    Same Problem and now working fine
    thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: