Skip to content

Instantly share code, notes, and snippets.

@scjody
Created February 5, 2018 18:16
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save scjody/287f8ca88d0055b7da9969357b762e7f to your computer and use it in GitHub Desktop.
Save scjody/287f8ca88d0055b7da9969357b762e7f to your computer and use it in GitHub Desktop.
EMACS TRAMP setup for "gcloud compute ssh"
;; TRAMP gcloud ssh
(add-to-list 'tramp-methods
'("gssh"
(tramp-login-program "gssh")
(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)))
@scjody
Copy link
Author

scjody commented Feb 5, 2018

Add this to your .emacs file to add a gssh method to TRAMP that connects to GCE instances on Google Cloud:
/gssh:some-instance:/path/to/file

gssh is a script I wrote that should be in your path. If you don't find gssh useful, you can replace it with gcloud compute ssh.

Based on https://qiita.com/tanatana/items/218b19808f2428b125fe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment