Skip to content

Instantly share code, notes, and snippets.

@jackrusher
Created June 19, 2019 13:58
Show Gist options
  • Select an option

  • Save jackrusher/36c80a2fd6a8fe8ddf46bc7e408ae1f9 to your computer and use it in GitHub Desktop.

Select an option

Save jackrusher/36c80a2fd6a8fe8ddf46bc7e408ae1f9 to your computer and use it in GitHub Desktop.

Revisions

  1. jackrusher created this gist Jun 19, 2019.
    19 changes: 19 additions & 0 deletions gcloud-tramp.el
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    ;; make sure you've set your default project with:
    ;; gcloud config set project <project-name>

    (require 'tramp)
    (add-to-list 'tramp-methods
    '("gcssh"
    (tramp-login-program "gcloud compute ssh")
    (tramp-login-args (("%h")))
    (tramp-async-args (("-q")))
    (tramp-remote-shell "/bin/sh")
    (tramp-remote-shell-args ("-c"))
    (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
    ("-o" "UserKnownHostsFile=/dev/null")
    ("-o" "StrictHostKeyChecking=no")))
    (tramp-default-port 22)))

    ;; ... after which it's as easy as:
    ;;
    ;; C-x C-f /gcssh:compute-instance:/path/to/filename.clj