gpt4 book ai didi

shell - VSCode SSH Remote 连接到 EC2 实例, "shell integration failed to activate"用于基于 zsh 的终端

转载 作者:行者123 更新时间:2023-12-05 05:36:31 25 4
gpt4 key购买 nike

VSCode SSH 远程连接到运行 Ubuntu 20.04 (ARM64) 的 AWS EC2 实例

我正在通过远程 SSH 扩展连接到使用 AWS SSM 的实例(在此处查看更多详细信息:https://github.com/aws/aws-toolkit-vscode/issues/941)工作正常,但 zsh shell 集成失败并显示消息 Shell integration failed to激活:

Launching a shell integrated zsh terminal

Resulting in the shell integration failed to activate error

与此同时,我可以轻松地创建一个基于 bash 的终端,然后编写 $ zsh:

Launching a shell integrated bash termnial

Resulting in working terminal

And manually entering zsh works as well

这是在 VSCode 的 Log (Window) Output 面板中生成的输出:

[2022-08-09 19:22:35.667] [renderer1] [error] EPERM: operation not permitted, copyfile 
'/data/home/pens/.vscode-server/bin/da76f93349a72022ca4670c1b84860304616aaa2/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-rc.zsh'
-> '/tmp/vscode-zsh/.zshrc':
Error: EPERM: operation not permitted, copyfile
'/data/home/pens/.vscode-server/bin/da76f93349a72022ca4670c1b84860304616aaa2/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-rc.zsh'
-> '/tmp/vscode-zsh/.zshrc'

它为以下点文件打印类似的错误:.zcompdump、.zlogin、.zprofile、.zshenv、.zshrc


最终这意味着问题与访问目录中的文件有关:/tmp/vscode-zsh/

每当尝试启动 shell 集成 zsh 终端时,VSCode 都会尝试在同一文件夹中为当前用户创建 5 个具有相同命名的点文件。这会导致 permission denied/operation not permitted 如果文件已经为另一个用户创建 - 并且由 - 另一个用户拥有。有什么解决办法吗?

最佳答案

这个问题是由于VSCode 1.70更新引起的,VSCode github上已经提了一个issue:https://github.com/microsoft/vscode/issues/157611

与此同时,解决方法是在您的 VSCode 设置中禁用 shellIntegration:"terminal.integrated.shellIntegration.enabled": false 并将以下内容添加到您的 .zshrc :

[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path zsh)"

关于shell - VSCode SSH Remote 连接到 EC2 实例, "shell integration failed to activate"用于基于 zsh 的终端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73292777/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com