Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

sftp: Cannot parse privateKey: Unsupported key format #171

Closed
xmmmmmovo opened this issue Feb 18, 2021 · 2 comments
Closed

sftp: Cannot parse privateKey: Unsupported key format #171

xmmmmmovo opened this issue Feb 18, 2021 · 2 comments

Comments

@xmmmmmovo
Copy link

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

  • Operating system: MacOS(6723.81.1)
  • Visual Studio Code version: 1.54.0-insider
  • Extension version: v0.89.0
@BuchyOne
Copy link

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
Copy link
Author

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants