vscode 通过ssh连接服务器卡断问题

vscode 通过ssh 连接服务器卡顿

背景:每次通过vscode连接vps服务器,服务器CPU都爆表,占用率支持100%,导致无法在终端执行任何操作

新建remote settings.json,Ctrl+Shift+P 输入Preferences: Configure Remote Settings 选择Remote: Configure Settings,或者选择open remote setting.json,前提是先连接服务器,不然没有open remote setting.json的选项,添加过滤服务器中某些大且深的目录,防止扫描,例如:

{
    "files.watcherExclude": {
    // ".autorelabel": true,
    // "bin": true,
    // "boot": true,
    // "currentPathFileName.json": true,
    // "data": false,
    // "dev": true,
    // "dingkang": false,
    // "docker-compose": false,
    // "etc": true,
    // "getCurrentDirAllFileName.sh": true,
    // "home": true,
    // "lib": true,
    // "lib32": true,
    // "lib64": true,
    // "libx32": true,
    // "lost+found": true,
    // "media": true,
    // "mnt": false,
    // "opt": true,
    // "path": true,
    // "proc": true,
    // "root": true,
    // "run": true,
    // "sbin": true,
    // "snap": true,
    // "srv": true,
    // "swap": true,
    // "sys": true,
    // "test": true,
    // "tmp": true,
    // "usr": true,
    // "var": true,
    // "wget-log": true,
    // "wget-log.1": true,
    // "wget-log.2": true
  },
  "files.exclude": {
    "etc": true,
    "home": true,
    "mnt": true,
  },
  "search.exclude": {
    "etc": true,
    "home": true,
    "mnt": true,
  }
}

一台服务器只用配置一次,这个配置会自动存储在服务器中,后面即使换电脑也能直接流畅连接

posted @ 2025-07-14 09:49  南宫影  阅读(277)  评论(0)    收藏  举报