Skip to content

Instantly share code, notes, and snippets.

@hmalphettes
Forked from haf/gist:2843680
Last active December 14, 2015 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hmalphettes/5027178 to your computer and use it in GitHub Desktop.
Save hmalphettes/5027178 to your computer and use it in GitHub Desktop.
Support for `vagrant ssh` via cygwin+openssh Original version of this patch uses 'where' which fails on cygwin

If you are using vagrant, you probably-statistically are using git. Make sure you have its binary folder on your path, because that path contains 'ssh.exe'.

Now, modify C:\vagrant\vagrant\embedded\lib\ruby\gems\1.9.1\gems\vagrant-1.0.3\lib\vagrant\ssh.rb to comment out the faulty Windows check and add a real SSH check:

 if Util::Platform.windows?
   if !Kernel.system("where ssh >NUL 2>&1") && !File.exists?("/usr/bin/ssh")
     raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],
                                        :port => ssh_info[:port],
                                        :username => ssh_info[:username],
                                        :key_path => ssh_info[:private_key_path]
   end
 else
   raise Errors::SSHUnavailable if !Kernel.system("which ssh >/dev/null 2>&1")
 end

Now you can do vagrant ssh. Happy camper again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment