I'm using the vscode-sftp extension in my Visual Studio Code workflow to upload files to my remote server, whenever I hit save. I am trying to achieve password-less authentication as I used to do with Sublime Text's SFTP plugin. However, the catch is that for vscode-sftp, in the sftp.json
file, I have to enter my Password as plain text for this to work:
{
"host": "mysamplehost.com",
"port": 22,
"username": "username",
"password": "password",
"protocol": "sftp",
"agent": null,
"privateKeyPath": null,
"passphrase": null,
"passive": false,
"interactiveAuth": false,
"remotePath": "/",
"uploadOnSave": true,
...
}
However, if I SSH into my server, I do not get asked for a password - since I have the SSH key in my MacBook. How do I configure vscode-sftp to use this authentication method?
I see the following comment in the documentation, however I don't know how to set this up:
/**
* string - Path to ssh-agent's UNIX socket for ssh-agent-based user authentication.
* Windows users: set to 'pageant' for authenticating with Pageant or (actual) path to a cygwin "UNIX socket.
*/
agent: null,
privateKeyPath: null, // absolute path to user private key
passphrase: null,
passive: false, // ftp passive mode