source
In order to get Emacs Tramp to work nicely with gcp's ssh'ing mechanism, some scripts and configurations need to be made.
gssh:
| if [[ $HOST = *"@"* ]] ; then |
| USER=$(echo $HOST | cut -d'@' -f1) |
| HOST=$(echo $HOST | cut -d'@' -f2) |
| gcloud config list | grep 'Your active' |
| ZONE=$(gcloud compute instances list |grep -E "^$HOST[[:space:]]" | awk '{print $2}') |
gcloud compute ssh --zone=$ZONE "$@"
Once that is set, edit .emacs and add a configuration for Tramp to use gssh:
| (add-to-list 'tramp-methods |
| (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)))
Done.
No comments:
Post a Comment