[英]VS code remote-ssh extension EINVAL error
在使用 remote-ssh vs 代碼擴展選擇 ssh 密鑰時出現這個奇怪的彈出錯誤自此錯誤開始以來沒有遠程連接成功
檢查了我的日志文件,但沒有得到比彈出窗口更多的信息似乎不適合 vs 代碼執行此 window 彈出窗口而不是右下角的通知
我已經努力在 SE 和谷歌上搜索這篇文章,但沒有運氣,如果沒有別的,我寧願從我的電腦上完全刪除 VScode 並從頭開始
2022-12-08 00:43:12.981 [info] Extension host with pid 388 started
2022-12-08 00:43:13.044 [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft'
2022-12-08 00:43:13.063 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.git
2022-12-08 00:43:13.073 [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*'
2022-12-08 00:43:13.091 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
2022-12-08 00:43:13.114 [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'
2022-12-08 00:43:13.141 [info] Eager extensions activated
2022-12-08 00:43:13.143 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2022-12-08 00:43:13.146 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onStartupFinished'
2022-12-08 00:43:13.151 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
2022-12-08 00:43:13.159 [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl-recommender, startup: false, activationEvent: 'onStartupFinished'
2022-12-08 00:43:13.167 [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-containers, startup: false, activationEvent: 'onStartupFinished'
2022-12-08 00:43:13.193 [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl, startup: false, activationEvent: 'onStartupFinished'
2022-12-08 00:43:46.716 [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-ssh, startup: false, activationEvent: 'onCommand:opensshremotes.openEmptyWindow'
2022-12-08 00:44:09.327 [error] Error: EINVAL: invalid argument, mkdir 'C:\Users\*username*\AppData\Local\Programs\Microsoft VS Code\"C:' opensshremotes.addNewSshHost {"value":"ms-vscode-remote.remote-ssh","c":"ms-vscode-remote.remote-ssh"}
2022-12-08 00:44:09.328 [error] Error: EINVAL: invalid argument, mkdir 'C:\Users\*username*\AppData\Local\Programs\Microsoft VS Code\"C:' opensshremotes.openEmptyWindow {"value":"ms-vscode-remote.remote-ssh","c":"ms-vscode-remote.remote-ssh"}
這是 exthost.log 中干凈的 window 上的持續性錯誤,省略了我的用戶名
運行 Windows 11 Home build 22621.819
我試過在 SE 和谷歌上查找解決方案,但每次都空手而歸。
我無法幫助您解決該錯誤,因為它不足以說明問題,但我會與您分享我的設置,您可以嘗試一下。
在您建立 SSH 到遠程 PC 的本地計算機上,在您的C:\Users\User\.ssh
目錄中創建一個新的config
文件(無擴展名)
以下是您必須根據評論更新的文件內容:
# This is the ssh client configuration sample file
# File syntax info: https://man7.org/linux/man-pages/man5/ssh_config.5.html
# Connection name as it will be displayed in Remote Explorer
Host Remote_SSH
# Specifies the real host name to log into.
HostName REMOTE_COMPUTER_NAME
# User name to which to log on on remote host
User RemoteAdminName
# Specifies the protocol versions in order of preference.
# The possible values are '1' and '2'.
# protocol version 1 is NOT RECOMMENDED for security reasons.
Protocol 2
# Specifies which address family to use when connecting.
# Valid arguments are: any, inet, inet6.
AddressFamily inet
# Specifies the ciphers allowed for protocol version 2 in order of preference.
# Multiple ciphers must be comma-separated.
# Run: "ssh -Q cipher" to see available chipers
Ciphers aes256-cbc,aes256-ctr
# Specifies a file from which the user's identity key is read when using public key authentication.
# This should be public key
IdentityFile ~\\.ssh\\YOUR_PUBLIC_SSH_KEY.pub
下一步是將您的公共 SSH 密鑰復制到遠程計算機的以下位置:
C:\Users\REMOTE_ADMIN_NAME\.ssh\authorized_keys
其中authorized_keys
不是一個目錄,而是一個沒有擴展名的文件,其中包含您的公共 SSH 密鑰。 (只需在遠程 PC 上將復制的密鑰重命名為authorized_keys
。
有關詳細信息,請參閱:
https://code.visualstudio.com/docs/remote/troubleshooting#_configuring-key-based-authentication
遠程計算機必須安裝 VSCode。
在本地配置文件中更新相關參數並在遠程計算機上設置 SSH 密鑰后,打開 VSCode 並單擊操作欄(側欄)中的Remote-Explorer
當你 hover 超過SSH
節點時點擊小+
號,如下圖所示:
然后在出現的框中鍵入 ssh 命令 ex。 ssh Admin@REMOTE_PC
這將顯示列表以選擇您之前創建的config
,select 從列表中選擇它。
然后你應該被提示連接到遠程主機。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.