是否可以在没有公共IP的GCLOUD上将VS代码与VM-INCENTANE集成在一起?

发布于 2025-01-30 10:24:54 字数 348 浏览 6 评论 0原文

我尝试与在其中具有公共IP的VM-Insance集成,并且可以正常运行。

但是,当我尝试连接到没有公共IP的VM-INSANCE时,

Host my-host
  IdentityFile ~/.ssh/google_compute_engine
  User user
  HostName instance-name
  ProxyCommand gcloud compute ssh --zone "zone" "instance-name"  --tunnel-through-iap --project "project-id"

我收到了消息: 无法连接到远程扩展主机服务器(错误:连接时计时)

I try to integrate with vm-instance having public ip in it and it works.

But when I try to connect to vm-instance that does not have public ip,

Host my-host
  IdentityFile ~/.ssh/google_compute_engine
  User user
  HostName instance-name
  ProxyCommand gcloud compute ssh --zone "zone" "instance-name"  --tunnel-through-iap --project "project-id"

I got message:
Failed to connect to the remote extension host server (Error: The connection timed out)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

玩世 2025-02-06 10:24:54

您可能需要考虑使用VS代码远程敲打
https://code.visualstudio.com/docs/docs/remote/隧道#_ using-the-code-cli

在远程Google Cloud private VM上:

  1. 获取VS代码远程通道

    curl -lk'https://code.visualstudio.com/sha/download?build = stable& os = cli-alpine-x64' - output vscode_cli.tar.gz.gz

  2. tar -xf vscode_cli.tar.gz

  3. ./代码隧道此命令下载并在该计算机上启动VS代码服务器,然后为其创建隧道。 注意:首次在机器上启动隧道时,将提示您接受服务器许可条款。

  4. 此CLI将输出vscode.dev URL与此远程计算机相关,例如https://vscode.dev/tunnel/< machine_name&ggt;/此URL在您选择的客户端上。


在您的本地环境上,在认证并提供了一个机器名称后,您可以使用几个连接到远程计算机的选项:

  1. 将URL从#4复制并粘贴到浏览器的地址栏中。
  2. 获得的URL

在直接的vs代码的桌面实例上,打开命令调色板并运行命令:远程 - 隧道:连接到隧道并粘贴您从#4

You might want to consider using VS Code Remote-Tunnels
https://code.visualstudio.com/docs/remote/tunnels#_using-the-code-cli

On the remote Google Cloud private VM:

  1. Get the VS Code remote-tunnel

    curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --output vscode_cli.tar.gz

  2. tar -xf vscode_cli.tar.gz

  3. ./code tunnel This command downloads and starts the VS Code Server on this machine and then creates a tunnel to it. Note: You will be prompted to accept the server license terms when you first start a tunnel on a machine.

  4. This CLI will output a vscode.dev URL tied to this remote machine, such as https://vscode.dev/tunnel/<machine_name>/<folder_name>. You can open this URL on a client of your choosing.

On your local environment, after authenticating and providing a machine name, you then have a couple of options for connecting to your remote machine:

  1. Copy and paste the URL from #4 into your browser's address bar.
  2. On a desktop instance of VS Code directly, open your command palette and run the command: Remote - Tunnels: Connect to Tunnel and paste the URL you got from #4

Command: Remote - Tunnels: Connect

I hope this helps!

蝶舞 2025-02-06 10:24:54

推入云源存储库 - - 然后从那里拉出或使用云构建来部署。

Push to Cloud Source Repositories - and either pull from there or use Cloud Build to deploy.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文