在%PATH%的任何目录中找不到`ssh`可执行文件

时间:2015-01-04 18:22:40

标签: ssh virtual-machine vagrant vagrantfile

ERROR:

c:\Users\dhawal.vora>vagrant ssh
`ssh` executable 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 information shown below:

Host: 127.0.0.1
Port: 2222
Username: vagrant
Private key: c:/Users/dhawal.vora/.vagrant/machines/default/virtualbox/private_key

请帮助????

Vagrant文​​件位于 -

之下
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.

# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "precise32"

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
config.vm.box_check_update = false

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080

# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "../data", "/vagrant_data"

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
#   # Display the VirtualBox GUI when booting the machine
#   vb.gui = true
#
#   # Customize the amount of memory on the VM:
#   vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.

# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
#   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end

# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline <<-SHELL
sudo apt-get install apache2
# SHELL
end

6 个答案:

答案 0 :(得分:83)

C:\Program Files\Git\usr\bin添加到PATH环境变量。

手动添加或我相信你可以在cmd中运行它:

set PATH=%PATH%;C:\Program Files\Git\usr\bin

从@Ygor Thomaz的评论

更新

或(64位)

set PATH=%PATH%;C:\Program Files\Git\usr\bin 

如果这不能解决您的问题,请执行以下操作:

Get SSH working on Vagrant/Windows/Git

答案 1 :(得分:2)

您也可以从here安装openssh,然后通过以下方式将ssh.exe添加到您的路径中:

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

set PATH=%PATH%;C:\Program Files\OpenSSH\bin

答案 2 :(得分:1)

使用Windows 10,我也无法设置路径&#39;工作的选择。但是,当我通过系统设置修改PATH变量并启动一个新的命令提示符时,它工作正常。

此外,在我阅读屏幕后,putty工作得很好,该屏幕告诉我使用&#39; core&#39;的用户名。

&#39;核心&#39;是我的配置要求尝试启动CoreOS。

答案 3 :(得分:0)

将C:\ Program Files \ Git \ usr \ bin添加到PATH环境变量并不适合我。 所以我为ssh连接配置了PUTTY。

答案 4 :(得分:0)

这篇精心编写的说明性教程概述了设置Vagrant SSH的方法。第一种方式是通过Git,第二种方式描述如何使用Putty。这很容易理解。

Running Vagrant SSH on Windows

答案 5 :(得分:0)

在我的情况下,即使向PATH添加ssh也无法解决问题。我必须做的是手动连接到流浪汉。执行vagrant后,我没有执行vagrant ssh,而是执行此操作:

ssh vagrant@127.0.0.1 -p 2222

密码是“vagrant”

要获取有关ip,端口和用户的所有信息,您可以使用

vagrant ssh-config

这可以帮助某人......