Wednesday, September 17, 2014

Configure MinGW-W64+MSYS to use PuTTY Plink/Pageant

Configure MinGW-W64+MSYS to use PuTTY Plink/Pageant

I forgot to document this last time so I figured I'd post to save anybody the trouble of figuring out how to do it again.

Install Putty/Pageant/Plink


For purposes of this document we assume you installed Pageant into:

C:\tools\PuTTY\pageant.exe

Load SSH keys into Pageant


Start Pageant and load in your SSH keys.  (Quick explanation here).

Configure Windows System Environment Variables


Windows key => "Environ" => Edit the system environment variables => [Environment Variables...]

Look in System variables, modify these if they exist, otherwise add them:

GIT_SSH = "C:\tools\PuTTY\plink.exe"
SVN_SSH = "C:\tools\PuTTY\plink.exe"

Click [OK]

Open new MinTTY (or other MSYS terminal)


Close any MSYS terminal or MinTTY that you have open, and open a new one.

Confirm that everything should be working:

bash$ env | grep -i ssh
GIT_SSH=C:\tools\PuTTY\plink.exe
SVN_SSH=C:\tools\PuTTY\plink.exe

Use PuTTY to connect to the host you want to access


For each new host you must use PuTTY to connect.  This is especially important when you are using git or svn or something that doesn't directly access ssh.  If you haven't yet connected to that host with PuTTY, the connection will probably fail.

Example first Github clone


PuTTY => New Session

  Hostname: github.com
  Click [Open]

You'll get a message from Pageant, do you want to save this key?  Click [Yes]

Now you should be good to go,  you can close the PuTTY window, and go back into MinTTY and try to git clone.

$ git clone git@github.com:joyent/node
Cloning into 'node'...

Obviously you should clone a repository to which you have access.  Everything should work.

Monday, September 15, 2014

Strawberry Perl on MinGW-W64 + MSYS

Strawberry Perl on MinGW-W64 + MSYS

Following up to my bare bones MinGW-W64 + MSYS install, I've found it to be convenient to install a version of Perl that you can actually keep updated easily.  The Perl version that comes with MSYS is really old.

Install Strawberry Perl

I'm using Strawberry Perl from http://strawberryperl.com

Download and install it.  I installed to C:\perl

Modify $PATH via ~/.bashrc

Add the following code to your ~/.bashrc assuming you installed to C:\perl

# Force Strawberry Perl to the front of the path
if [ -x /c/perl/perl/bin/perl.exe ]; then
export PATH="/c/perl/perl/bin:$PATH"
fi


Exit your shell and start a new shell.

Make sure it worked

ross@win$ which perl
/c/perl/perl/bin/perl.exe

Success!  Enjoy your modern Perl.