You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行gcloud alpha cloud-shell ssh时PuTTY提示“Server refused our key”求助

Troubleshooting "No supported authentication methods available" when connecting to Cloud Shell via local gcloud

Hey Michael, let's work through this Cloud Shell SSH issue you're hitting. Since you can access Cloud Shell just fine through the web console, we know the instance itself is healthy—so the problem is almost certainly tied to your local authentication setup or how the gcloud alpha cloud-shell ssh command is handling keys. Here are some actionable steps to fix this:

  • Force a full key regeneration and session re-authorization
    Sometimes even after clearing your .ssh folder, gcloud might not properly sync a new key pair with Cloud Shell. Run this command to overwrite any existing keys and re-establish a trusted session:

    gcloud alpha cloud-shell ssh --authorize-session --force-key-file-overwrite
    

    This ensures the key gcloud generates locally is explicitly authorized by the Cloud Shell server.

  • Verify gcloud is using the correct SSH key file
    Try manually specifying the key path to eliminate any ambiguity. First, regenerate the compute SSH keys with:

    gcloud compute config-ssh
    

    Then connect using the newly generated key:

    gcloud alpha cloud-shell ssh --ssh-key-file=C:\Users\[YourUsername]\.ssh\google_compute_engine
    

    Replace [YourUsername] with your actual Windows user folder name.

  • Fix PuTTY key format compatibility
    On Windows, gcloud often relies on PuTTY, which uses .ppk formatted keys instead of OpenSSH's default format. You can either:

    1. Use PuTTYgen to convert the google_compute_engine private key to a .ppk file, then specify it in the command:
      gcloud alpha cloud-shell ssh --ssh-key-file=C:\Users\[YourUsername]\.ssh\google_compute_engine.ppk
      
    2. Switch gcloud to use the OpenSSH client instead of PuTTY with this config change:
      gcloud config set ssh/ssh_executable openssh
      
      This avoids format mismatches entirely.
  • Reset your Cloud Shell instance
    Sometimes the Cloud Shell server side might have cached invalid key data. In the web console's Cloud Shell, run exit to terminate the instance, then click the "Start Cloud Shell" button again to spin up a fresh instance. Try connecting locally once it's ready.

  • Check for local network interference
    Local SSH agents (like Pageant) or firewall/antivirus tools can block key authentication. Close any running SSH agents temporarily, disable your firewall's network filtering for a test, then re-run the gcloud alpha cloud-shell ssh command. If this works, you'll need to add exceptions for gcloud or the SSH port.

内容的提问来源于stack exchange,提问作者Michael Ames

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 09:34:56