When connecting to a remote machine using VS Code Remote SSH this act always opens a new VS Code Window. Is there a way to change this behavior to use the existing open window? Thanks
Asked
Active
Viewed 3,728 times
17
-
I don't think there is. VSCode needs to re-initialize a lot of things in the remote session so it has to be restarted. – jss367 May 13 '20 at 22:18
-
Will submit a feature request for this. Perhaps a way can be found. – lordhog May 19 '20 at 21:52
-
It is possible to drag the tab from new window to existing local workbench but having two simultaneous remote connections in the same window doesn't work [yet]. – Bharath May 19 '20 at 22:43
-
I have the same problem, open always a new window, and cannot put it together my workspace opened previously – MCunha98 Nov 14 '20 at 20:08
2 Answers
18
There is a separate command for this.
You need to do Remote-SSH: Connect Current Window to Host...
instead of Remote-SSH: Connect to Host...

davetapley
- 17,000
- 12
- 60
- 86
-
This does not work for me. Latest 1.7 vscode no matter what I do, even from no workspace, nothing, when i choose remote connection it *always* spawns a new window. – GeneralZod Dec 13 '22 at 15:44
-
I just updated and still works for me on [this](https://gist.githubusercontent.com/davetapley/ce12f74f1824886ccabbacd2e7d292cf/raw/d6ac93f0858be9e77af5a158c8f7cbd7e0201111/code). Maybe [open a bug](https://github.com/microsoft/vscode-remote-release/issues/new/choose) to see if OS specific? – davetapley Dec 15 '22 at 12:34
-
I won't delete my comment but my answer was not to expect an open project to instantiate a new remote ssh session in the same vscode process, so a new process is required by design in my use case. – GeneralZod Dec 15 '22 at 15:43
-
It does not work: it is true that it uses the same window, but before doing so it removes anything open. It has the same effect as closing the current window and creating a new one. – Giancarlo Sportelli Jul 28 '23 at 16:21
-1
vscode open terminal / PowerShell
input:ssh user@hostname and Enter password

DQ WEI
- 29
- 1
-
While many wrongly gave this post negative votes, this is why I was here. Thank you my friend for the solution. Shame on those who voted negatively. – Thanasis Nov 22 '22 at 09:42
-
This solution just accesses the remote host through a terminal... it's getting downvoted because the question is asking about launching a remote repository through the Remote-SSH extension, which opens a new window by "default". – ru111 Dec 14 '22 at 18:42