Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcloud SSH in same terminal window

I use gcloud cloud-shell ssh to connect to Google Cloud Shell. However, this spawns a new window, (PuTTY) which bothers me. Is there a way (some -- flag / &c.) to use it from the same console window?
Thanks in advance!

like image 926
Tuor Avatar asked Sep 11 '25 06:09

Tuor


1 Answers

I found a solution to open Google Cloud Shell directly in the terminal window instead of using PuTTY on Windows.

You can achieve this by modifying the lib\googlecloudsdk\command_lib\util\ssh\ssh.py file. Locate the following section:

if platforms.OperatingSystem.IsWindows():
    suite = Suite.PUTTY
    bin_path = _SdkHelperBin()
else:
    suite = Suite.OPENSSH
    bin_path = None
return Environment(suite, bin_path)

Replace it with the following code:

if platforms.OperatingSystem.IsWindows():
    # suite = Suite.PUTTY
    # bin_path = _SdkHelperBin()
    suite = Suite.OPENSSH
    bin_path = None
else:
    suite = Suite.OPENSSH
    bin_path = None
return Environment(suite, bin_path)

The question is quite old, over a year ago, but hopefully it's still useful.

like image 184
omgiman Avatar answered Sep 15 '25 22:09

omgiman