vagrant ssh not working in MobaXterm on Windows

后端 未结 5 733
臣服心动
臣服心动 2021-01-13 21:45

I have already found \"SSH to Vagrant box in Windows\" and added the git bin directory to my windows PATH. I verified that it worked by starting CMD and typing ssh

相关标签:
5条回答
  • 2021-01-13 22:21

    you can install git (https://git-scm.com/downloads) during install git choose "use git and optional Unix tools from the windows command prompt"

    0 讨论(0)
  • 2021-01-13 22:28

    Download msysgit from msysgit project page and include msysgit/bin folder to PATH, now you can run ssh and vagrant ssh form your terminal on windows.

    0 讨论(0)
  • 2021-01-13 22:31

    Part of the trick is that I don't want to use the Windows PATH for arbitrary commands—not even for ssh, really. I want to use the versions in MobaXterm for everything. All I want is to be able to run vagrant ssh the same way I would on Linux or Mac.

    The workaround I have been using, which I found somewhere online (but can't find the page again), is:

    vagrant ssh-config > vagrant-ssh
    ssh -F vagrant-ssh default  # Works exactly the way `vagrant ssh` should
    

    "default" is the box name for a typical Vagrant environment with only a single vagrant box. If there is more than one box, replace "default" with the box name:

    ssh -F vagrant-ssh host001  # Works the way `vagrant ssh host001` would on another system
    

    This is a good workaround with minimal changes required to workflow. But I'd still like a way to get vagrant ssh working without needing the extra file in my vagrant directory.

    0 讨论(0)
  • 2021-01-13 22:34

    Call me crazy but what about doing this:

    • Setup Vagrant Virtualbox VM like normal
    • In MobaXterm, create a "Bash" shell integration with the working directory setup as the directory of the Vagrant directory for the specific VM you are doing this for (aka ... the directory where the Vagrantfile lives for this VM)
    • In the "Advance Shell Settings", use this command (adjust vagrant path to where ever your Vagrant is installed as MobaXterm bash sees it):

    command /drives/c/HashiCorp/Vagrant/bin/vagrant ssh-config > vagrant-ssh-config && ssh -A -F vagrant-ssh-config default

    Vagrant VM needs to be up for MobaXterm Bash entry for the VM to work. I just setup two Bash shell settings for two Vagrant Virtualbox VMs I created and it seems to work just fine.

    Updated: I went a little further since I've figured this out .. at least for me I did :). I added additional CMD shell sessions MobaXterm for each of my Vagrant VM. These additional CMD shell sessions do Vagrant halt, up, and restart (combo of halt and up) commands against the VMs they are specific to. This is what restart looks like:

    vagrant halt
    vagrant up
    set /p value="Press Enter to continue"
    exit

    The Startup Directory for the above session is, again, the directory where the Vagrantfile lives for this VM. Oh, and make sure that "Use Windows PATH" is checked in Terminal Settings.

    0 讨论(0)
  • 2021-01-13 22:36

    here you can find an explanation

    In the documentation, this mention is in the "Terminal tab settings" section, so you will find this option in the "Terminal" tab.

    Go to MobaXterm global settings window, then click on the "Terminal" tab and check the "Use Windows PATH environment". Note that if you are using a session, you will have to do the same in this session: edit your session, then go to the "Terminal settings" tab and check the "Use Windows PATH" option.

    0 讨论(0)
提交回复
热议问题