Setup for Windows

First, install the following base applications. During the installation process, if any of the applications below ask if you want to add the executible to your Shell or Path; answer yes.

Composer, SSH, Composer and WP-CLI installation require additional manual steps. Continue below.


SSH Setup

Git comes bundled with OpenSSH so SSH should have been installed.

Open the Git Bash application and enter the following:

touch ~/.bashrc

Open the newly created ~/.bashrc file in your text editor and add the following contents:

SSH_ENV=$HOME/.ssh/environment
# wp command alias
# alias wp='c:/wp-cli/wp-cli.phar'
# start the ssh-agent
function start_agent {
    echo "Initializing new SSH agent..."
    # spawn ssh-agent
    /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
    echo succeeded
    chmod 600 "${SSH_ENV}"
    . "${SSH_ENV}" > /dev/null
    /usr/bin/ssh-add
}

if [ -f "${SSH_ENV}" ]; then
     . "${SSH_ENV}" > /dev/null
     ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
        start_agent;
    }
else
    start_agent;
fi

SSH Config: (~./ssh/config)

In Git Bash, create the config file. This will allow you to connect to servers using shorthand syntax.

touch ~./ssh/config

In your text editor, add the following to the newly created ~./ssh/config file:

# Infomedia Dev Server
Host infodev
HostName 107.170.79.132
User infomedia
IdentityFile ~/.ssh/id_dsa
PubkeyAcceptedKeyTypes +ssh-dss

In order to connect to the server over SSH, you'll need to generate your SSH keys. For more information on connecting to the server over SSH, see the documentaion for SSH Keys and SSH Config.


Composer

Reference

Download Composer

During installation, the installer will ask for the path to your php executible. The path to PHP is C:\MAMP\bin\php\php7.0.0.

If you receive this error, open C:\MAMP\bin\php\php7.0.0\php.ini-production and find this line:

;extension=php_openssl.dll

Uncomment and load the extension by removing the ; character. Save and complete the installation.

The correct value should be:

extension=php_openssl.dll


WP-CLI Installation

Reference

  • Create a folder at c:\wp-cli
  • Download and save wp-cli.phar to c:\wp-cli\wp-cli.phar
  • Create a file named wp.txt in c:\wp-cli with the following contents:
@ECHO OFF
php "c:/wp-cli/wp-cli.phar" %*
  • Save and rename wp.txt to wp.bat
  • Add c:\wp-cli to your path with the following command:
setx path "%path%;c:\wp-cli"

Lastly, refer to the SSH Setup step above and open ~/.bashrc in your text editor. Uncomment the line below so that the wp command will available:

# alias wp='c:/wp-cli/wp-cli.phar'

Uncomment by removing the # character. Now is a good time to reboot your PC.


CLI Installation Helpers

The final steps are to install the CLI helpers for Grunt, Bower and Gulp. Open Git Bash and run the following commands:

npm install -g grunt-cli
npm install -g bower
npm install -g gulp
gem install sass
gem install compass

Reference

If you get command not found errors in any of the above, check to make sure the executibles are in your Paths. Below are the values found in a fresh installation on my system. Your Path may contain additional items. Be sure to leave those in tact unless you know that they are no longer needed.

User (PATH):

%USERPROFILE%\AppData\Roaming\npm;C:\Ruby22-x64\bin

System (Path):

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\nodejs\;C:\MAMP\bin\php\php7.0.0;C:\ProgramData\ComposerSetup\bin