--- id: Remote-SSH title: "Remote SSH" type: concept tags: [development, remote, ssh, vscode] sources: [] last_updated: 2026-04-15 --- ## Definition Remote SSH 是 VS Code/Trae 的核心插件,允许通过 SSH 连接在远程服务器上运行编辑器后端(VS Code Server/Trae Server),开发者获得与本地开发几乎一致的体验,同时利用远程服务器的算力和存储。 ## How It Works 1. 本地机器通过 SSH Config 连接到远程服务器 2. Trae 在远程服务器自动安装 Trae Server(首次连接约几十秒) 3. 所有编辑、终端、插件操作均在远程服务器执行 4. 本地仅作为 UI 终端渲染 ## SSH Config Setup ``` Host ubuntu2 HostName 192.168.3.45 User shenwei Port 22 IdentityFile ~/.ssh/id_rsa ``` ## Common Issues - Git 凭证:Trae 自动转发本地 SSH Agent,需在本地启动 ssh-agent - 文件权限:容器内生成文件归属 root,通过 --user 参数或 Dockerfile 指定 UID 解决 ## Related Concepts - [[Trae]]:支持 Remote SSH 的 AI 代码编辑器 - [[SSH Agent转发]]:凭证传递机制 - [[Docker Attach模式]]:Remote SSH 与 Docker 容器开发的结合