I'm new to using Tramp and have set it up to work with a remote host. However, on that remote host, I need to execute
module load git before I can use git. I've tried adding that to my remote
.bash_profile but my local Emacs (Tramp) doesn't seem to see it.
I also tried creating a
git.sh on the remote host that checks if git was loaded and loads it if not, and then passes all other arguments to the real git. That script is:
#!/usr/bin/env bash if [[ $(module list 2>&1 | grep git) == "" ]]; then module load git fi git $@
And then telling Magit to use that git with
(setq magit-remote-git-executable "/home/<user>/bin/git.sh"), but this also did not work.
Is there a way I can get Tramp or Magit to execute commands before running git?
My current config is:
(use-package tramp :ensure nil :config (setq tramp-default-method "ssh") (setq tramp-default-remote-shell "/usr/bin/bash") (setq explicit-shell-file-name "/usr/bin/bash") (setq tramp-sh-extra-args '(("/bash\\'" . "-l")))