VS Code settings

本文详细介绍了如何在VSCode中配置远程SSH开发环境,包括下载安装软件、设置SSH密钥、编辑settings.json文件、安装远程SSH插件以及解决常见问题等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

内容包括设置、连接服务器等操作

1. download and install

2. install python inside the software

3. open terminal to add ssh key to target server

参考: Linux 添加ssh公钥_天下皆白_唯我独黑的博客-CSDN博客_ssh 添加公钥

(1) 在当前环境输入: ssh-keygen  密码可有可无,没有直接按回车

(2) 把当前环境 的 .ssh/id_rsa.pub 内容复制到目标服务器的 .ssh/authorized_keys 

4. 按F1搜索 打开 settings.json

输入以下内容并保存

{
    "terminal.integrated.profiles.windows": {
    "Git-Bash": {
        "path": "C:\\Program Files\\Git\\bin\\bash.exe",
            "args": []
        }
    },
    "terminal.integrated.defaultProfile.windows": "Git-Bash",
    "remote.SSH.remotePlatform": {
        "10.0.120.198": "linux"
    },
    "python.linting.flake8Enabled": true,
    "python.linting.flake8Args": ["--max-line-length=160"],
    "python.linting.pylintEnabled": false,
    "python.terminal.activateEnvironment": false,
    "git.autofetch": true,
    "python.linting.pylintArgs": [
        "--extension-pkg-whitelist=cv2",
        "--generate-members"
    ],
    "terminal.integrated.rendererType": "dom",
    "terminal.integrated.inheritEnv": false,
    "workbench.sideBar.location": "left",
    "editor.rulers": [160]
}

5. install remote-ssh

6. F1 "Remote-SSH: Connect to Host..."

"+ Add New SSH Host" 输入: "ssh xxx@host-name of ip address"

添加一个host, 在界面左侧会显示已添加的host。需要使用时点击名字右侧图标打开

7. 接“6“,按F1 打开 python select inteperter选择python

5. 安装 flake8 (格式检查)

6. done

** 打开terminal快捷键 “ctl + 、”

补充:

tips:

1.  "Visual Studio Code is unable to watch for file changes in this large workspace" (error ENOSPC)

官方链接:Running Visual Studio Code on Linux

在VS Code里修改的方法:

在{}settings.json里添加

"files.watcherExclude": {
        "**/.git/objects/**": true,
        "**/.git/subtree-cache/**": true,
        "**/node_modules/*/**": true,
        "**/generator/out/*":true
    },
    "files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/*.bmp": true,
        "**/*.png": true, 
        "**/*.h5": true,
    }

其中:

"**/*.bmp": true,
"**/*.png": true, 
"**/*.h5": true

是自己添加的。可以根据需要修改添加。

2. 如果想在bash里运行conda activate但是提示没有conda这个命令,检查~/.bash_profile 里有没有添加conda路径

eval "$('/c/ProgramData/Miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"

如果已添加,但是还是有以上错误,则需要在settings.json里添加以下内容,每次打开bash会自动运行~/.bash_profile

"terminal.integrated.shellArgs.windows": ["-l"],

以上参数已被舍弃

在 ~/.bashrc 添加

if [ -f ~/.bashrc ]; then
    source ~/.bash_profile
fi

如果没有的话

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值