VS Code使用教程

链接远程服务器

https://blog.csdn.net/zhaxun/article/details/120568402

免密登陆服务器

1生成客户机(个人PC)密令

ssh-keygen -t rsa

生成的文件在主目录的.ssh文件当中。

查看密令并复制到linux系统当中

cat id_rsa.pub 

在这里插入图片描述

2复制到服务器中

echo "xxxx" >> ~/.ssh/authorized_keys

"XXX"代表的是客户机中生成的密令。
然后重启服务器的ssh服务。

sudo service sshd restart

3测试

commond(ctrl)+shit+P -> Reload Window -> Enter
在这里插入图片描述
不需要密码,流畅进入。

远程debug和选环境

在这里插入图片描述
运行时报错找不到文件,可能是相对路径错误:
只要你在每次使用 Code Runner 调试时, cd 一下进入对应的文件夹就可以正常运行的。如果需要更高级的修改,可以参考下面这篇文章。
No such file or directory. 解决VSCode相对路径出错问题

unable to watch for file changes in this large workspace问题

在这里插入图片描述
官方解决方案如下:
官方方案

“Visual Studio Code is unable to watch for file changes in this large workspace” (error ENOSPC)
When you see this notification, it indicates that the VS Code file watcher is running out of handles because the workspace is large and contains many files. Before adjusting platform limits, make sure that potentially large folders, such as Python .venv, are added to the files.watcherExclude setting (more details below). The current limit can be viewed by running:

cat /proc/sys/fs/inotify/max_user_watches

The limit can be increased to its maximum by editing /etc/sysctl.conf (except on Arch Linux, read below) and adding this line to the end of the file:

sudo vim /etc/sysctl.conf

在最下面加上这句话。

fs.inotify.max_user_watches=524288

The new value can then be loaded in by running sudo sysctl -p. #加载新的值

While 524,288 is the maximum number of files that can be watched, if you’re in an environment that is particularly memory constrained, you may want to lower the number. Each file watch takes up 1080 bytes, so assuming that all 524,288 watches are consumed, that results in an upper bound of around 540 MiB.

猜你喜欢

转载自blog.csdn.net/adreammaker/article/details/134905889