Does VS Code Remote SSH Share Your Local Clipboard?
Yes. With Remote-SSH, the VS Code window you're looking at is still the app on your Windows PC; only the VS Code Server, your workspace extensions and the terminal shell run on the remote host. So anything you copy in the editor or the integrated terminal goes straight to your local Windows clipboard, and Ctrl+V pastes from it, with no forwarding to set up. What doesn't reach your clipboard is a program running on the server, such as xclip or a script, because it can only see the remote machine.
What runs where
| Part | Runs on | Clipboard it uses |
|---|---|---|
| VS Code window: editor, terminal panel, Explorer, Command Palette | Your Windows PC | Your Windows clipboard |
| UI extensions (themes, keymaps, snippets) | Your Windows PC | Your Windows clipboard |
| Workspace extensions (language servers, linters, most others) | Remote host | Your clipboard if they use VS Code's clipboard API; otherwise the remote machine's |
Shell and programs in the terminal (bash, xclip, Python scripts) | Remote host | The remote machine's clipboard, if it has one |
Microsoft's Remote-SSH documentation describes this split: the extension installs VS Code Server on the remote OS, extensions that affect the UI install locally, and any terminal you open runs on the remote host.
Copying from the editor and terminal
Everything you select and copy in the window lands on your Windows clipboard, and it shows up in Win+V history like any other copy.
- Editor: Ctrl+C and Ctrl+V work as they do for local files.
- Integrated terminal: on Windows, Ctrl+C copies when text is selected and Ctrl+V pastes. Right-click copies the selection if there is one, otherwise it pastes;
terminal.integrated.rightClickBehaviorchanges that. Turn onterminal.integrated.copyOnSelectionif you want selecting text to copy it. - Explorer: Copy Path and Copy Relative Path give you the path on the remote machine, such as
/home/you/project/src/app.py, not a Windows path.
Pasting goes the other way just as easily. Text you copied from a browser on Windows pastes into a remote file or the remote shell. If you paste several lines into the terminal, VS Code warns you first when the shell doesn't support bracketed paste mode.
Why xclip or pbcopy on the server doesn't reach your PC
Command-line clipboard tools run on the machine where you type them. Over Remote-SSH that's the server, so:
xclip,xselandwl-copytry to write to the server's own X11 or Wayland clipboard. A headless server usually has none, so they fail. Even when they succeed, the text stays on the server.- Scripts that use a clipboard library behave the same way, because they're programs on the remote host.
You don't need to install anything to fix this. To get command output onto your clipboard, print it in the integrated terminal and select it, or redirect it to a file (some-command > out.txt), open the file from the VS Code Explorer and copy from the editor. Both copies happen in the local window.
When an extension copies to the wrong clipboard
Most extensions copy through VS Code's own clipboard API, which writes to your local clipboard even when the extension runs remotely. A few use Node modules such as clipboardy instead. Running on the remote host, those modules touch the remote machine's clipboard, so a "Copy" button in the extension appears to do nothing. VS Code's remote troubleshooting guide lists this as a known extension problem; the fix is for the extension to switch to the VS Code clipboard API, so report it to the extension's author.
Moving files between Windows and the remote host
Text crosses freely, but don't count on the clipboard to move files to or from the server. Use one of these instead:
- Upload: drag files from Windows File Explorer onto the VS Code Explorer. Remote development has supported dropping files onto remotes since VS Code 1.36.
- Download or copy many files: use
scpfrom PowerShell, for examplescp you@server:/home/you/project/report.csv .(scpcomes with the OpenSSH client built into Windows). For whole folders,rsyncon a machine that has it, or a synced folder, is faster. - Screenshots for a remote Markdown file: save the image on Windows and upload it as a file, rather than expecting a pasted bitmap to arrive as a file on the server.
Remote SSH vs WSL, containers and Remote Desktop
Dev Containers and WSL use the same model as Remote-SSH: the window is local and copies go to your Windows clipboard. WSL also lets Linux programs reach the Windows clipboard directly through clip.exe; what crosses the WSL boundary covers that. Remote Desktop is different: the whole desktop is remote, and clipboard sharing depends on RDP redirection settings. If that's your setup, see Remote Desktop copy-paste not working.
Privacy: remote secrets end up in local history
Because every copy in the remote window lands on your PC, an API key or password you copy from a server's config file is now in your local clipboard history, and in Microsoft's cloud too if clipboard sync is set to sync automatically. Pin nothing sensitive, clear history after handling secrets, and read is an API key on the clipboard a security incident? for the cleanup steps.
FAQ
Do I need X11 forwarding for copy and paste in Remote-SSH?
No. Copy and paste in the VS Code editor and terminal use the local window, so no X server, DISPLAY variable or xclip is involved.
Does Win+V clipboard history work with Remote-SSH?
Yes. Press Win+V in the remote editor or terminal and pick an item; it pastes like any typed text. Does VS Code have clipboard history? covers the options.
Why does pasted text in the remote terminal look garbled?
Usually the program on the remote side doesn't handle bracketed paste or the text contains control characters. How to copy from Windows Terminal without garbled text explains the causes, which are the same in VS Code's terminal.
Related reading
- WSL Clipboard: Copy and Paste Between Linux and Windows
- Does VS Code Have Clipboard History? Extensions vs Win+V
- How to Paste Into Windows Terminal Safely
- Remote Desktop Copy and Paste Not Working? 7 Fixes
Sources
- Remote Development using SSH (VS Code docs) — VS Code Server on the remote host, local UI extensions, and remote terminals.
- Remote Development troubleshooting tips (VS Code docs) — "Clipboard does not work" for extensions that use Node clipboard modules.
- Terminal basics (VS Code docs) — copy and paste keys on Windows, right-click behaviour, copy on selection and the multi-line paste warning.
- June 2019, version 1.36 (VS Code release notes) — drag and drop files to remotes.
Deepender Yadav created Edge Drop and builds and tests it, from the edge-hover shelf to each release. A B.Tech Computer Science Engineering student, Deepender writes the Edge Drop guides, comparisons and developer posts, and checks product details against the app's source code.
GitHub · LinkedInCopy. Stack. Drop.
Transform your clipboard into an interactive edge shelf. Stack, pin, and drag assets into any app with zero friction.
Download for Windows Get from Microsoft Store
How to Install Guide · First 10 Minutes Guide · Drag & Drop Guide · Edge Drop vs Win+V · Support
Free · Lightweight · Privacy First