Skip to content

Instantly share code, notes, and snippets.

@sorenmacbeth
Forked from jackrusher/gcloud-tramp.el
Created October 14, 2020 23:55
Show Gist options
  • Save sorenmacbeth/d4e216d228c582a2eacd3e24a3135b9b to your computer and use it in GitHub Desktop.
Save sorenmacbeth/d4e216d228c582a2eacd3e24a3135b9b to your computer and use it in GitHub Desktop.
Tramping into GCloud instances from within emacs
;; 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment