在服务器跑完程序需要下载数据的时候报错:
[warn] ENOENT: no such file or directory, open '/home/LIST_2080Ti/.ssh/config' load /home/LIST_2080Ti/.ssh/config failed
完整报错内容如下:
[02-10 08:38:47] [info] config at /home/LIST_2080Ti {"remotePath":"/home/LIST_2080Ti/njh","uploadOnSave":false,"useTempFile":false,"openSsh":false,"downloadOnOpen":false,"ignore":["**/.vscode/**","**/.git/**","**/.DS_Store/**","**/_pycache_/**"],"concurrency":4,"protocol":"sftp","connectTimeout":10000,"interactiveAuth":false,"secure":false,"remoteTimeOffsetInHours":0,"remoteExplorer":{"order":0},"name":"My Server","host":"10.201.0.131","port":22,"username":"******","password":"******","syncMode":"update","watcher":{"files":"**/*","autoUpload":false,"autoDelete":false}}
[02-10 08:39:32] [warn] ENOENT: no such file or directory, open '/home/LIST_2080Ti/.ssh/config' load /home/LIST_2080Ti/.ssh/config failed
[02-10 08:39:33] [error] Error: No such file
at 101 (/home/LIST_2080Ti/.vscode-server/extensions/natizyskunk.sftp-1.16.1/node_modules/ssh2/lib/protocol/SFTP.js:2704:19)
at SFTP.push (/home/LIST_2080Ti/.vscode-server/extensions/natizyskunk.sftp-1.16.1/node_modules/ssh2/lib/protocol/SFTP.js:278:11)
at CHANNEL_DATA (/home/LIST_2080Ti/.vscode-server/extensions/natizyskunk.sftp-1.16.1/node_modules/ssh2/lib/client.js:525:23)
at 94 (/home/LIST_2080Ti/.vscode-server/extensions/natizyskunk.sftp-1.16.1/node_modules/ssh2/lib/protocol/handlers.misc.js:859:16)
at Protocol.onPayload (/home/LIST_2080Ti/.vscode-server/extensions/natizyskunk.sftp-1.16.1/node_modules/ssh2/lib/protocol/Protocol.js:2025:10)
at AESGCMDecipherNative.decrypt (/home/LIST_2080Ti/.vscode-server/extensions/natizyskunk.sftp-1.16.1/node_modules/ssh2/lib/protocol/crypto.js:987:26)
at Protocol.parsePacket [as _parse] (/home/LIST_2080Ti/.vscode-server/extensions/natizyskunk.sftp-1.16.1/node_modules/ssh2/lib/protocol/Protocol.js:1994:25)
at Protocol.parse (/home/LIST_2080Ti/.vscode-server/extensions/natizyskunk.sftp-1.16.1/node_modules/ssh2/lib/protocol/Protocol.js:293:16)
at Socket.<anonymous> (/home/LIST_2080Ti/.vscode-server/extensions/natizyskunk.sftp-1.16.1/node_modules/ssh2/lib/client.js:713:21)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
解决方案
(1)Upload Folder 和 Download Folder 在 uploadOnSave 和 watcher 都关闭的情况下使用。
我把这两项都删除了,同样报错。
(2) "remotePath": "/home/LIST_2080Ti/njh",
开头也是斜杠开头。仍旧不行。
(3)我又重新检查的时候,发现,其实不用非要从服务器界面download,咱们可以使用同步功能直接把服务器上生成的文件同步回来就行。不过是在本地选择:
直接从远程同步到本地(Sync Remote->Local)就行。
此时需要注意的是,一定要选择准确文件,不要把不想要的程序版本同步到原版的内容上。
不过就算想全部同步,你也要保存一个备份,防止服务器版本彻底覆盖本地版本。
下面分享一下我的sftp config,因为里面的remotePath很重要。
{
"name": "My Server",
"host": "10.201.0.131",
"protocol": "sftp",
"port": 22,
"username": "LIST_2080Ti",
"remotePath": "/home/LIST_2080Ti/njh",
"uploadOnSave": false,
"useTempFile":false,
"openSsh":true
}
更具体的sftp配置参考下面这篇:
配置远程服务器时候sftp的配置以及注意事项【在本地配置sftp】_ACMSunny的博客-CSDN博客_sftp配置文件在哪