You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code Remote-SSH已设localServerDownload仍不使用本地服务器求助

解决VS Code Remote-SSH离线连接时仍强制下载Server的问题
  • 确认版本完全匹配
    本地VS Code的版本必须和上传的Server包完全一致,包括小版本号。查看本地版本:帮助→关于,比如1.89.1,对应的Server包要找同版本的(比如vscode-server-linux-x64-1.89.1.tar.gz)。解压后的目录要放到~/.vscode-server/bin/<commit-id>/,其中<commit-id>是VS Code版本对应的哈希值,可在本地关于页面或Server包解压后的product.json里找到。

  • 修正目录结构与权限
    确保解压后的Server文件路径是~/.vscode-server/bin/<commit-id>/,设置正确的所有者和权限:

    chown -R $USER:$USER ~/.vscode-server/
    chmod -R 755 ~/.vscode-server/bin/<commit-id>/
    

    检查~/.vscode-server根目录下是否有server.sh,没有的话从解压目录里复制过来。

  • 配置VS Code与SSH,强制使用本地Server
    打开VS Code的settings.json,除了"remote.SSH.localServerDownload": "always",添加:

    "remote.SSH.serverInstallPath": {
        "你的服务器IP/别名": "~/.vscode-server"
    }
    

    编辑~/.ssh/config,给目标服务器加启动命令:

    Host your-server-name
        HostName 192.168.x.x
        User your-username
        RemoteCommand ~/.vscode-server/bin/<commit-id>/server.sh --port 0
        RequestTTY yes
    
  • 手动启动Server,跳过下载逻辑
    先通过普通SSH连到服务器,手动启动Server:

    ~/.vscode-server/bin/<commit-id>/server.sh --port 0
    

    保持进程运行,再用VS Code发起Remote-SSH连接,此时会检测到已运行的Server,不再触发下载。

  • 清除本地缓存
    关闭VS Code,删除本地缓存目录:

    • Windows: %APPDATA%\Code\Cache、%APPDATA%\Code\CachedData
    • macOS: ~/Library/Caches/Code、~/Library/Application Support/Code/CachedData
    • Linux: ~/.cache/code、~/.config/Code/CachedData
      重启VS Code后重试连接。

内容的提问来源于stack exchange,提问作者Jack Brands

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 21:57:07