简体   繁体   中英

Why does vagrant ssh'ing always re-ask me for my ssh executable?

Using Vagrant under Windows 7, trying to ssh into my VM. If I open cmd and run vagrant ssh , I am given the response:

ssh exectuable not found in any directories in the %PATH% variable, Is an SSH client installed? Try installing Cygwin, MinGW, or Git, all of which contain an SSH client. Or use your favorite SSH client with the following authentication...

So I add Git to my PATH variable:

set PATH=%PATH%;C:\Program Files (x86)\Git\bin

And I confirm my PATH variable now contains this:

<snip>C:\ProgramData\ComposerSetup\bin;C:\Program Files\cURL\bin;"C:\Program Files (x86)\Git\bin";"C:\Program Files (x86)\Git\cmd";C:\Program Files\nodejs\;C:\HashiCorp\Vagrant\bin

So, I run vagrant ssh again, and it works:

vagrant ssh
Welcome to Ubuntu...
vagrant@mywebsite:~$

But, if I now close my cmd window and reopen it, I can no longer call vagrant ssh . I'm given the same notice I was initially given about not having an SSH client in my PATH variable. What this means is that essentially, I am being re-asked every time to provide an SSH client.

Why?

You have set the variable only for the current command session - you need to set as environment variable

For windows 7

  1. From the Desktop, right-click the Computer icon and select Properties. If you don't have a Computer icon on your desktop, click the Start button, right-click the Computer option in the Start menu, and select Properties.
  2. Click the Advanced System Settings link in the left column.
  3. In the System Properties window, click on the Advanced tab, then click the Environment Variables button near the bottom of that tab.
  4. In the Environment Variables window (pictured below), highlight the Path variable in the "System variables" section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon as shown below. You will end up with something similar as

    C:\\ProgramData\\ComposerSetup\\bin;C:\\Program Files\\cURL\\bin;"C:\\Program Files (x86)\\Git\\bin";"C:\\Program Files (x86)\\Git\\cmd";C:\\Program Files\\nodejs\\;C:\\HashiCorp\\Vagrant\\bin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM