Since last week I can't log into my virtual machine via SSH (via web). Already increased the disk space, increased RAM, already created a new SSH and includes in metadata, nothing worked ...

When I try to connect to my local machine, I get this message:

Permission denied (publickey). ERROR: (gcloud.compute.ssh) Could not SSH to the instance. It is possible that your SSH key has not propagated to the instance yet. Try running this command again. If you still cannot connect, verify that the firewall and instance are set to accept ssh traffic.

1 Answer 1


You need to specify the path of the private key when you run the SSH command:


Here is how to locate the key [1].

For more information on how to troubleshoot this kind of issues [2].

Maybe the instance has OS Login enabled and it disables metadata-based SSH key configurations on those instances [3].


[1] https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys#locatesshkeys

[2] https://cloud.google.com/compute/docs/instances/connecting-advanced

[3] https://cloud.google.com/compute/docs/instances/managing-instance-access#enable_oslogin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.