Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode remote ssh -- how to automatically install extensions

How do I install VSCode extensions in an SSH connection without doing it through the VSCode UI? I have an environment that spins up a new VM for git branches, and it's really annoying to have to go manually install every extension for each new VM.

I've tried adding them to a devcontainer.json file, which is ignored (it only works on containers, not ssh, even in the newest release that's had some support for the file via ssh connections).

I could add a bunch of packages to vscode's settings, but I want to avoid that because what I install is different based on whether I'm looking at a rust service, node, etc and it's pretty pointless to install every conceivable package in every vm.


1 Answers

Get extensions IDs

  1. cmd: code --list-extensions, example output :

    foo.bar
    foo1.bar2
    
  2. Visual Studio Code: Open settings file, add option:

    "remote.SSH.defaultExtensions": [
        "foo.bar",
     ]
    
  3. On the SSH target :

    rm ~/.vscode-server
    
  4. Reconnect VSCode Remote Server

like image 120
walkman Avatar answered Jun 22 '26 16:06

walkman