VSコードリモートサーバファイルの編集
3091 ワード
VSコードリモートサーバファイルの編集
拡張
Remote Developmentは、VSコードの公式プラグインで、リモートフォルダに接続します.This Remote Development extension pack includes three extensions:
Remote - SSH - Work with source code in any location by opening folders on a remote machine/VM using SSH. Supports x86_64 and ARMv7l (AArch32) glibc-based Linux hosts. VS Code Insiders also supports ARMv8l (AArch64) glibc-based Linux hosts. Remote - Containers - Work with a sandboxed toolchain or container based application by opening any folder mounted into or inside a container. Remote - WSL - Get a Linux-powered development experience from the comfort of Windows by opening any folder in the Windows Subsystem for Linux.
プラグインのインストール
直接VSコードカードで検索
リモートフォルダの接続
まずサーバ上でSSHサービスを開始する必要があります
コンフィギュレーションVSコード設定に追加 VSコード左下隅に似ている><>^<><のボタンをクリックして選択
問題
エラーが発生しましたDownloading VS Code Server failed.Please try again later.
ソリューション:ファイルを手動でサーバにダウンロードし、置き換えます.
ずっとパスワードを入力したくない
Linuxサーバの信頼にローカルSSH公開鍵を追加するソリューションローカルに入る 存在するか確認 試してみることができる
拡張
Remote Development
を使用して、リモート・サーバに接続します.Remote Developmentは、VSコードの公式プラグインで、リモートフォルダに接続します.This Remote Development extension pack includes three extensions:
Remote - SSH - Work with source code in any location by opening folders on a remote machine/VM using SSH. Supports x86_64 and ARMv7l (AArch32) glibc-based Linux hosts. VS Code Insiders also supports ARMv8l (AArch64) glibc-based Linux hosts. Remote - Containers - Work with a sandboxed toolchain or container based application by opening any folder mounted into or inside a container. Remote - WSL - Get a Linux-powered development experience from the comfort of Windows by opening any folder in the Windows Subsystem for Linux.
プラグインのインストール
直接VSコードカードで検索
Remote Development
そのままインストールすればいいです.リモートフォルダの接続
まずサーバ上でSSHサービスを開始する必要があります
コンフィギュレーション
"remote.SSH.showLoginTerminal": true
Remote-SSH:Connect to Host...
プロンプトに従って配置すればいいので、その間にlinuxアカウントのパスワードを入力するように指示して入力すればいい.問題
エラーが発生しましたDownloading VS Code Server failed.Please try again later.
Running remote connection script
Installing to /home/xxx/.vscode-server/bin/2213894ea0415ee8c85c5eea0d0ff81ecc191529...
Downloading with wget
....
"install" terminal command done
Received install output: b7a67c2b-5d04-47c6-8be8-999adf02ef0c##25##
Server download failed
Downloading VS Code Server failed. Please try again later.
------
ソリューション:ファイルを手動でサーバにダウンロードし、置き換えます.
cd ~/.vscode-server/bin/*/
wget https://update.code.visualstudio.com/commit:2213894ea0415ee8c85c5eea0d0ff81ecc191529
#commit:
tar -zxvf vscode-server-linux-x64.tar.gz -C ./
mv vscode-server-linux-x64/* .
touch 0
#
ずっとパスワードを入力したくない
Linuxサーバの信頼にローカルSSH公開鍵を追加するソリューション
C://Users/YourName/.ssh/
フォルダid_rsa/
存在しない場合ssh-keygen
生成id_rsa/id_rsa.pub
サーバにコピーした~/.ssh/
この公開鍵ファイルに新しい名前を付けることができる/etc/ssh/sshd_config
の中のPubkeyAuthentication yes
とAuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
のコメントで、コピーしたばかりのファイルの名前を.ssh/authorized_keys
の後に付けます.ssh name@server_ip
サーバーをローカルに接続し、パスワードの入力を促すメッセージがなければ修正に成功した.