Skip to content

Instantly share code, notes, and snippets.

@pnminh
Last active May 12, 2020 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pnminh/4f33a231aaa2d1d615de68f927e25f5c to your computer and use it in GitHub Desktop.
Save pnminh/4f33a231aaa2d1d615de68f927e25f5c to your computer and use it in GitHub Desktop.
VsCode SSH Workspace

SSH Workspace

Install VsCode

On Fedora/RHEL/CentOS

$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
$ sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
$ sudo dnf check-update
$ sudo dnf install code
$ code

Go to extension menu (Ctrl+Shift+X)
Extension menu

Search for and select Remote-SSH extension from Microsoft (should be the first one from the list)
Search Remote-SSH

Install the extension
Install Remote-SSH

Go to View > Command Pallete (or Ctr+Shift+P) and search for the command Remote-SSH: Connect to host... to run a SSH session or Remote-SSH: Add New SSH Host to persist the host configurations for future usage.
Connect Remote-SSH

Input the hostname and enter. Add password/ssh key location when prompted
Add Remote-SSH

After vscode connects successfully to the hostname, we should see the hostname at the bottom left. Also go to Terminal > New Terminal will give us the direct ssh session with the host.
Terminal in Remote-SSH

We then can have our remote workspace run on the host machine. Select File > Open Folder (Ctrl+O) to open the workspace
Open folder in Remote-SSH

We can also install extensions on the remote workspace such as yaml from Red Hat and kubernetes
Other extensions in Remote-SSH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment