gcloud compute ssh停止

时间:2019-03-09 03:17:39

标签: google-cloud-platform google-compute-engine putty gcloud

我正在使用gcloud ssh连接gce。

> gcloud compute --project "first-medium-2****8" ssh --zone "us-east1-b" "instance-2"

我在powershell中输入了上述命令,但它答复了

>Using username "hogehoge".

>Authenticating with public key "DESKTOP-****hogehoge"

然后停止。没事。

昨天我做了同样的事情,没有问题。

但是今天,我不能。我尝试了gcloud init,然后重新安装了gcloud。

但是什么都没有改变。我该怎么办才能解决这个问题?

其他信息。

  • 操作系统Windows10

  • Google Cloud SDK 237.0.0

  • PowerShell 5.1.17134.590

  • 油灰0.70(仅一次安装)

note1:我发现我可以毫无问题地使用Cloud Shell。 但是,云外壳有超时。所以我更喜欢gcloud而不是云外壳。

note2:当我使用cloudshell时,它作为“ tomotomo”连接。 使用gcloud时,不是“ hogehoge”用户名。

当我运行“ gcloud computing ssh VM_NAME --verbosity = debug --log-http”

它答复

>DEBUG: SSH Known Hosts File [C:\Users\hogehoge\.ssh\google_compute_known_hosts] could not be opened: Unable to read file
[C:\Users\hogehoge\.ssh\google_compute_known_hosts]: [Errno 2] No such file or directory: u'C:\\Users\\hogehoge\\.ssh\\goo
gle_compute_known_hosts'
DEBUG: Current SSH keys in project: [u'tomotomo:ssh-rsa AAAAB*** 
DEBUG: Running command [C:\Users\hogehoge\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\sdk\putty.exe -t -i C:\User
s\hogehoge\.ssh\google_compute_engine.ppk hogehoge@3*****].
DEBUG: Executing command: [u'C:\\Users\\hogehoge\\AppData\\Local\\Google\\Cloud SDK\\google-cloud-sdk\\bin\\sdk\\putty.ex
e', u'-t', u'-i', u'C:\\Users\\hogehoge\\.ssh\\google_compute_engine.ppk', u'hogehoge@3*****']

时间很长,所以我只摘录我认为重要的内容。

2 个答案:

答案 0 :(得分:1)

运行

  

putty -cleanup

解决了这个问题。

Putty将一些信息保存在注册表中。(IP地址,公钥等)

此命令将删除那些注册表和随机种子文件。

答案 1 :(得分:0)

按照@redpawn运行“ putty -cleanup”解决了该问题。