Skip to content

Instantly share code, notes, and snippets.

@joshschmelzle
Created November 18, 2017 01:50
Show Gist options
  • Save joshschmelzle/eeeb31d78b0c39221a1f6a38cb3c39cd to your computer and use it in GitHub Desktop.
Save joshschmelzle/eeeb31d78b0c39221a1f6a38cb3c39cd to your computer and use it in GitHub Desktop.
SSH client from Git rather than Putty or Cygwin

Some popular SSH clients on Windows include Cygwin and Putty. But, there is another option. One that has a more integrated SSH experience. Both Cygwin and Putty run in separate console experiences. The goal here is to be able to type ssh [email protected] in whatever console I want and for it to work.

If you have git for windows installed, you already have the software to do this. The bundle has several Linux familiar tools. Many probably use these in the git bash shell.

But, you don't need to run the git bash shell on windows to access SSH. You just need to make a small modification to your path.

If you know your location, just add it to your path:

$new_path = "$env:PATH;C:/Program Files/Git/usr/bin"
$env:PATH=$new_path
[Environment]::SetEnvironmentVariable("path", $new_path, "Machine")

Now type ssh:

C:\>ssh
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-J [user@]host[:port]] [-L address] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address]
           [-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]
           [user@]hostname [command]

Don't have git installed?

Just use chocolatey and install git.

iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
choco install git -params "/GitAndUnixToolsOnPath"

Note that the GitAndUnixToolsOnPath param sets the environment variable for you. Once you install git you will need to open a new shell for git. Then ssh will be available in your console.

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