使用场景:C/C++代码在linux服务器上,用VS Code可以调试这份代码
一. 安装git(主要是为了能用ssh),官网:Git
1. 打开git bash,输入ssh-keygen -t rsa,一路回车,之后会在~/.ssh目录下生成生成id_rsa和id_rsa.pub文件;
2. 复制id_rsa.pub文件内容到linux下~/.ssh/authorized_keys,没目录就创建,没文件就创建;
3. 加权限,chmod 700 -R ~/.ssh;
git配置完了
二. 打开VS Code
1. 安装Remote Development插件;
2. 在设置里启用remote.SSH.showLoginTerminal;
3. ctrl+shift+p打开命令行,输入>remote ssh config会出现命令,选择,再选择C:\Users\xxx\.ssh\config,编辑:
# Read more about SSH config files: https://linux.die.net/man/5/ssh_config
Host Centos7.3 # 主机名
HostName 192.168.88.200 # ip
User root
Port 22
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
点击连接,输入yes,等待安装vs code server,搞定
补充:离线安装vs code serverhttps://www.cnblogs.com/sinicheveen/p/13812278.htmlhttps://www.cnblogs.com/sinicheveen/p/13812278.html