mkloubert / vs-deploy

Visual Studio Code extension that provides commands to deploy files of a workspace to a destination.
https://marketplace.visualstudio.com/items?itemName=mkloubert.vs-deploy
MIT License
131 stars 24 forks source link

Support private key file for SSH authentication? #132

Closed DavidA2014 closed 6 years ago

DavidA2014 commented 6 years ago

When using SFTP, I would like to be able to specify a private key file for SSH authentication, rather than use a password. Does Deploy support private key files? (I couldn't find it in the documentation).

mkloubert commented 6 years ago

Yes, sftp supports things like privateKey property.

DavidA2014 commented 6 years ago

Thanks, privateKey worked for me.

DavidA2014 commented 6 years ago

Would you expect to be able to use an environment variable in the private key path?

"privateKey": "/%HOMEPATH%/Documents/ssh_keys/pc_priv.ppk"

That gives an error for me:

[FAILED: Error: ENOENT: no such file or directory, open 'C:\%HOMEPATH%\Documents\ssh_keys\pc_priv.ppk']

Finished with errors!

mkloubert commented 6 years ago

Placeholders work in another way.

In your case, you have to use homeDir, which is pre-defined:

  "privateKey": "${homeDir}/Documents/ssh_keys/pc_priv.ppk"

You also can import environment variables and use your HOMEPATH, if it is available for the process of your editor:

  "privateKey": "${HOMEPATH}/Documents/ssh_keys/pc_priv.ppk"
DavidA2014 commented 6 years ago

Thank you, that works fine.