1

I would like to use gcloud compute ssh with portforwarding options in windows. When I executed following command in "Google Cloud SDK Shell" shortcut on desktop, it worked.

Welcome to the Google Cloud CLI! Run "gcloud -h" to get the list of available commands.
---

C:\Program Files (x86)\Google\Cloud SDK>gcloud compute ssh instance-name --tunnel-through-iap -- -L xxxx:localhost:vvvv
C:\Program Files (x86)\Google\Cloud SDK>

But when I executed same command in powershell, it failed.

PS C:\Users\xxxx> gcloud compute ssh instance-name --tunnel-through-iap -- -L  xxxx:localhost:vvvv
ERROR: (gcloud.compute.ssh) unrecognized arguments:
  -L
  xxxx:localhost:vvvv
  To search the help text of gcloud commands, run:
  gcloud help -- SEARCH_TERMS

How can I pass SSH args to gcloud command in powershell? I could not use past command history in "Google Cloud SDK Shell" shortcut, so I would like to use powershell (in which I can use past command history). Thanks.

2
  • You should add gcloud cli to your PATH env variables. stackoverflow.com/questions/31037279/… Commented Apr 6, 2022 at 7:23
  • Thanks, when I executed commands without SSH args(-- -L xxxx:localhost:vvvv), it works. Commented Apr 6, 2022 at 12:08

1 Answer 1

2

I should quote 2 dashes as '--' when I execute commands in powershell. Following command works in powershell according to link.

gcloud compute ssh instance-name --tunnel-through-iap '--' -L  xxxx:localhost:vvvv
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.