【问题标题】:VSCode integrated terminal in Remote SSH ignores /etc/profile.d/*远程 SSH 中的 VSCode 集成终端忽略 /etc/profile.d/*
【发布时间】:2021-06-14 15:38:20
【问题描述】:

当我使用 VSCode 集成终端通过 Remote SSH 登录 Linux 远程工作站时,/etc/profile.d/* 中的 shell 脚本将不会被执行。 ~/.bash_profile 等其他一些脚本也可能会被忽略。

例如,如果我有一个导出一些PATH/etc/profile.d/cuda.sh 文件,则PATH 环境变量将在普通SSH 中进行相应修改,但在VSCode 终端中不会。

【问题讨论】:

    标签: shell visual-studio-code vscode-settings


    【解决方案1】:

    由于 VSCode 终端的行为与 SSH 登录不同,您应该在远程 SSH 配置中添加以下内容 (File > Preferences > Settings > Remote):

    "terminal.integrated.shellArgs.linux": [
        "--login", "-i"
    ],
    

    如果你的工作站是Windows,可以参考this question

    【讨论】:

      【解决方案2】:

      这些是我必须在 Settings > Features > Terminal > Integrated > Profiles:Linux 中设置的设置(单击以在 settings.json 中进行编辑(对我来说,设置文件是:~/.config/Code/User/settings.json)):

          "terminal.integrated.defaultProfile.linux": "bash",
          "terminal.integrated.profiles.linux": {
              "bash": {
                "path": "bash",
                "args": ["--login", "-i"],
                "icon": "terminal-bash"
              },
              "zsh": {
                "path": "zsh"
              },
              "fish": {
                "path": "fish"
              },
              "tmux": {
                "path": "tmux",
                "icon": "terminal-tmux"
              },
              "pwsh": {
                "path": "pwsh",
                "icon": "terminal-powershell"
              }
            }
      

      【讨论】:

        猜你喜欢
        • 2021-11-23
        • 2021-06-01
        • 2019-06-12
        • 2021-11-01
        • 1970-01-01
        • 2022-07-17
        • 2023-01-17
        • 2018-10-23
        • 1970-01-01
        相关资源
        最近更新 更多