Skip to main content

Command Palette

Search for a command to run...

Remote Development using SSH on VS Code

Published
L

Full stack web 3D developer

I have to say amazing after remote ssh on vs code. Debugging and preview remote on vs code is what I want for a long time. What a pity, it's too late to meet 🤣.

The Visual Studio Code Remote - SSH extension allows you to open a remote folder on any remote machine, virtual machine, or container with a running SSH server and take full advantage of VS Code's feature set. Once connected to a server, you can interact with files and folders anywhere on the remote filesystem.

Step1: Generate an SSH Key

execute: ssh-keygen

output:

Generating public/private rsa key pair.

Enter file in which to save the key (/Users/user-name/.ssh/id_rsa): input the absolute path here.

Enter passphrase (empty for no passphrase):

Then, you got two file in your .ssh directory. Something like tutorial and tutorial.pub.

Step2: Copy the key to a server

Once an SSH key has been created, the ssh-copy-id command can be used to install it as an authorized key on the server. Once the key has been authorized for SSH, it grants access to the server without a password.

ssh-copy-id -i ~/.ssh/mykey user@host

Only the public key is copied to the server. The private key should never be copied to another machine.

Step3: Install VS Code extension

Download Remote-SSH

Step4:Create a config file

Host aws-ec2 
    HostName 188.188.1.8
    User ubuntu
    IdentityFile /Users/user-name/.ssh/file-name
- Host (aws-ec2) is just a name that will appear in VS Code. It can be any name.
- HostName is the server’s host or IP.
- User is the Ubuntu username.
- IdentityFile is the path to the private key.

Step5:Configure in VS Code

  • Show all command to find remote-ssh Screen Shot 2022-03-23 at 15.55.57.png
  • Excute the Connect to Host

Screen Shot 2022-03-23 at 15.58.21.png

  • Configure SSH Hosts Screen Shot 2022-03-23 at 16.00.48.png

  • Setting configure path Screen Shot 2022-03-23 at 16.00.29.png

Screen Shot 2022-03-23 at 16.01.03.png

  • Excute the Connect to Host Select one you have configired.

Screen Shot 2022-03-23 at 16.03.19.png

Then, connected. Screen Shot 2022-03-23 at 16.04.06.png

Enjoy remote developing, debug and preview locally with the power of VS Code.

Thanks for your reading.

Have a good day.

More from this blog

如何将静态页面部署到Github Page,并绑定自定义域名

在仓库主页选择setting 点击pages 选择分支branch 输入自定义域名custom domain(设置好后点击save,系统将自动在项目根目录生成CNAME文件,文件内容为设置的当前域名) 在域名提供商处,添加DNS设置(以阿里云为例) 配置CNAME 配置IP,创建一个A类记录指向185.199.108.153 github将根据访问域名路由项目仓库(仓库名称为iddz.fun,并且根目录有CNAME文件) 最后,通过访问自定义域名,完成静态网站的部署...

Oct 4, 2023
如何将静态页面部署到Github Page,并绑定自定义域名

熟悉熟悉官方文档,逐步深入Babylon.js

文档的组织结构 通过前一篇文章的了解,我们会对Babylon.js有了一个大致的了解,整个文档主要是想带你逐步深入掌握这个Babylon.js所提供的所有内容。 内容主要分为一个概览和9个主要部分,这些部分包含章节,还有API详解和强大的文档和playground搜索功能。 - 1.Babylon.js特性 - Babylon.js是一个功能完备的游戏和渲染引擎,具有广泛的特性。这个部分将带你了解这些特性,并帮助你编码和使用它们。- 2.将Babylon.js添加到你的Web项目中 - 有多种...

Sep 25, 2023
熟悉熟悉官方文档,逐步深入Babylon.js

Lizhiyu's Blog

33 posts

Bringing the world closer together through play