I'm editing files in vim over ssh, and I'd like to save git commits and things by running external commands in vim, like :!git add % && git commit -m "update" but because my server (hostgator) has a limited shell, cpanel jailshell, I get the error:

Cannot execute shell /usr/local/cpanel/bin/jailshell

Is there a way to configure the shell settings in vim so that external commands work?


You can turn this around and use sshfs to mount the remote files over an ssh connection and use your tools that are local to your computer to interact with them (i.e. vim & git).

Take a look at this tutorial on sshfs.


$ modprobe fuse
$ sshfs sessy@mycomputer:/home/sessy /mnt/sessy -C -p 9876

Now just cd into /mnt/sessy and use vim and git locally. When you're done unmount it.

$ fusermount -u /mnt/sessy
  • This is way better than editing using a remote vim. Thanks! – Jonathan Jun 19 '13 at 15:57
  • @Jon - If this worked would you mind accepting it so that others know your question has been resolved? Thanks. – slm Jun 19 '13 at 16:20
  • @sim, This hack is better, but it doesn't really solve the original problem, which was that external commands weren't running in vim over ssh. Although your solution obviates the need for running stuff on my server (since I can run it locally), it'd be misleading to accept this as the answer, since others that might have the same issue won't really find the answer to this question. – Jonathan Jun 19 '13 at 17:02
  • @Jon - fair enough. Does your method solve the problem? It sounds like it does, if so I'd accept it instead then. – slm Jun 19 '13 at 17:05
  • @sim, It does solve the problem. It won't let me accept it for another 17 hours for some reason. – Jonathan Jun 19 '13 at 18:54

I ended up getting this to work by adding set shell=/bin/bash to my .vimrc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.