VS Code的远程开发调试

概述

Visual Studio Code Remote Development allows you to use a container, remote machine, or the Windows Subsystem for Linux (WSL) as a full-featured development environment. You can:

Develop on the same operating system you deploy to or use larger or more specialized hardware.
Sandbox your development environment to avoid impacting your local machine configuration.
Make it easy for new contributors to get started and keep everyone on a consistent environment.
Use tools or runtimes not available on your local OS or manage multiple versions of them.
Develop your Linux-deployed applications using the Windows Subsystem for Linux.
Access an existing development environment from multiple machines or locations.
Debug an application running somewhere else such as a customer site or in the cloud.
No source code needs to be on your local machine to get these benefits. Each extension in the Remote Development extension pack can run commands and other extensions directly inside a container, in WSL, or on a remote machine so that everything feels like it does when you run locally.
在这里插入图片描述

先决条件

确保本机已经安装 VS CODE

安装ssh客户端

确保本机已安装 SSH client, 并且确保远程主机已安装 SSH server
win7系统可以到这里下载客户端
https://github.com/PowerShell/Win32-OpenSSH/releases
在这里插入图片描述
解压可用,可以用来生成密钥对,需要配置win7搜索路径,然后重启vscode,在vscode的终端中就可以使用ssh了。
先在终端中免密连下远程主机,应该没问题,才能进行下一步。
在这里插入图片描述

安装vscode扩展

为本机 VS CODE 安装 Remote Development 扩展
在这里插入图片描述

配置远程连接

配置免密登录

可参考https://blog.csdn.net/gsl371/article/details/79719776

设置远程连接参数

vscode中Ctrl + Shift + p 输入 Remote-SSH:setting… 回车
在这里插入图片描述
设置Remote.SSH:Show Login Terminal为true,这样可以在vscode终端中使用远程终端。

在这里插入图片描述

连接远程主机

安装完插件后左下角会出现一个绿色的图标,点击选择会在命令窗口弹出几个选项
在这里插入图片描述

编辑远程主机配置文件

选择Remote-SSH:Connect to Host->Configure SSH Hosts->选择一个config
在这里插入图片描述
指定一个配置文件,不要选标注的,这个是本地win7安装openssh后,用ssh-keygen产生的的目录;选择下面的那个
在这里插入图片描述
如果选错了,可以把生成的配置文件删除了,再按左下绿色图标,连接远程,选择刚才的配置
在这里插入图片描述
在这里插入图片描述
连接完成,会在vscode终端显示连接信息
在这里插入图片描述

打开远程文件

然后可以在vscode中选打开文件或文件夹,可以选择远程

在这里插入图片描述

在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值