【问题标题】:`ssh` executable not found in any directories in the %PATH%在 %PATH% 的任何目录中都找不到“ssh”可执行文件
【发布时间】:2017-09-10 05:40:49
【问题描述】:

错误:

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

【问题讨论】:

  • 您需要在放置Vagrantfile的同一目录中运行该命令。
  • 我这样做了,但徒劳无功......
  • 您可以将文件Vagrantfile 粘贴到您的问题中吗?

标签: ssh virtual-machine vagrant vagrantfile


【解决方案1】:

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

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

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

更新自 @Ygor Thomaz 的 cmets

或(64 位)

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

如果这不能解决您的问题,请通过:

Get SSH working on Vagrant/Windows/Git

【讨论】:

  • 或(64 位)设置 PATH=%PATH%;C:\Program Files\Git\usr\bin
  • 为我工作,但在设置路径后重新启动窗口!也可以看看:blog.osteel.me/posts/2015/01/25/…
  • 为什么将 Git\usrs\bin 添加到路径有帮助? git 是什么为 vagrant 提供了“ssh 客户端”?
【解决方案2】:

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

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

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

【讨论】:

    【解决方案3】:

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

    此外,在我阅读告诉我使用用户名“core”的屏幕后,putty 工作得很好。

    'core' 是我尝试启动 CoreOS 的配置的要求。

    【讨论】:

      【解决方案4】:

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

      【讨论】:

        【解决方案5】:

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

        Running Vagrant SSH on Windows

        【讨论】:

          【解决方案6】:

          在我的情况下,即使将 ssh 添加到 PATH 也不能解决问题。我必须做的是手动使用 ssh 连接到 vagrant。执行 vagrant up 后,我不执行 vagrant ssh,而是这样做:

          ssh vagrant@127.0.0.1 -p 2222
          

          密码是“vagrant”

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

          vagrant ssh-config
          

          这对某人有帮助...

          【讨论】:

            猜你喜欢
            • 2016-01-29
            • 1970-01-01
            • 2017-04-28
            • 1970-01-01
            • 2019-01-16
            • 2015-01-25
            • 2015-05-19
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多