Remote -SSH to GCP-VM
Remote -SSH to GCP VM
Step 1 install Remote - SSH extenxions
Step 2 google GCP 確定你的VM
Step 3 connect your VS Code ,快速鍵 F1 或 View > Command Palette
Step 4 搜尋Remote - SSH > Remote - SSH: Open SSH Configuration File
Step 4.2打開 使用者配置檔案 /User/codeart/.ssh/config
對應的參數
1 | |
Step 6 打開Terminal (終端機) 或 按熱鍵
Step 7 在終端機 cd 到 /User/codeart/ 資料夾下面 建立資料夾 mykeys 產生私錀
1 | |
Step 8 建立一個名叫mykeys新資料夾,放私錀的地方
1 | |
Step 9 cd 到你的mykeys 子目錄下
1 | |
Step 10 打入以下命令,產生ssh 公錀
1 | |
Step 11 打入 ls 查詢是否產生 remote-ssh-demo 私錀與 remote-ssh-demo.pub公錀
1 | |
Step 12 把 私錀 加入 到 IdentityFile 底下
1 | |
Step 13 打開remote-ssh-demo.pub 公錀 並復製
Step 14 回到GCP VM 點擊編輯 往下拉到 安全殼層金鑰 新增項目 貼上公錀 按下儲存
Step 15 回到 VS cdoe 設定VS code 讓 VM 連接到你的VS Code ,快速鍵 F1 或 View > Command Palette
搜尋Remote - SSH > Remote - SSH: Connect to Host 並點擊
Step 16 連線中..…點擊Continue
Step 17 測試新增資料夾看看 open folder ,點擊OK
Step 18 點擊 信任
Step 19 測試建立一個web 資料夾, 是否可兩端同步
Remote -SSH to GCP-VM
https://stonetein.github.io/codeArt-TechBlog/2024/07/09/Remote-SSH-to-GCP-VM/