mkloubert / vscode-deploy-reloaded

Recoded version of Visual Studio Code extension 'vs-deploy', which provides commands to deploy files to one or more destinations.
https://marketplace.visualstudio.com/items?itemName=mkloubert.vscode-deploy-reloaded
GNU Lesser General Public License v3.0
163 stars 39 forks source link

sftp: Cannot parse privateKey: Unsupported key format #171

Closed xmmmmmovo closed 3 years ago

xmmmmmovo commented 3 years ago

Description

When I use private key to deploy my code to my remote server, it says that "Cannot parse privateKey". But I always use this key to login my remote server.

Example config

{
  "deploy.reloaded": {
    "packages": [
      {
        "name": "os",

        "deployOnSave": true,

        "files": ["**/**"],

        "targets": ["os"]
      }
    ],
    "targets": [
      {
        "type": "sftp",
        "name": "os",

        "dir": "secret",
        "host": "secret",
        "port": secret,

        "user": "xmmmmmovo",
        "privateKey": "/Users/xmmmmmovo/.ssh/gh-pages"
      }
    ]
  }
}

Screenshot

Error in vscode:

image

success to ssh my remote server:

image

I usually use sftp to deploy my project, so I think it's not my server configuration's error.

image

Your environment

BuchyOne commented 3 years ago

Depending on how you generate your keys. Current OpenSSH behaviour

So, if you use:

ssh-keygen -o

gives this first line:

-----BEGIN OPENSSH PRIVATE KEY-----

Try PEM option:

ssh-keygen -m pem -f /path/to/key

Then you see

-----BEGIN RSA PRIVATE KEY-----

'It is still possible for ssh-keygen to write the previously-used PEM format private keys using the -m flag' from: [https://man.openbsd.org/ssh-keygen#m]

xmmmmmovo commented 3 years ago

Depending on how you generate your keys. Current OpenSSH behaviour

So, if you use:

ssh-keygen -o

gives this first line:

-----BEGIN OPENSSH PRIVATE KEY-----

Try PEM option:

ssh-keygen -m pem -f /path/to/key

Then you see

-----BEGIN RSA PRIVATE KEY-----

'It is still possible for ssh-keygen to write the previously-used PEM format private keys using the -m flag' from: [https://man.openbsd.org/ssh-keygen#m]

Thanks to reply my problem! After appear this problem, I have been search for solution on Google, and finally I solve this probem by using another plugin named sftp

P.S. This problem caused by the dependency named ssh2-sftp-client(has been proposed in the repository's issue)