How to SSH Forward on Windows

For a while I had a convoluted approach to working in Vagrant, deploying new versions, checking out private repos, etc.

I came across a process that might help some people who want to use the same private/public key for Vagrant that you use for GitHub, Bitbucket, and your production servers.

I couldn’t find anything on this forum, so if someone already added this procedure, please disregard. But this process is useful if you:

  • You’re on a Windows host (Useful for Mac/Linux too)

  • You have private repos as part of your Trellis project

  • You want Vagrant to use your already created SSH key pair.

First, in this Vagrantfile, he uses a config file for his public/private key file paths, so if you don’t do that, add your path. For instance, my keys are in C:\users\myuser\.ssh

So I just use “~/.ssh/id_rsa” and “~/.ssh/”

Pay attention to Line 120-166 in this file

Then get his two ssh scripts from this folder ( and and add them to your ansible folder.

Again, make sure you fix all the path(s) for your local environment.

After doing this, and vagrant up, I can login to the vagrant machine with my standard keys I use on Github. This also lets me checkout things easily without copying any keys over, and deploy new versions of my site.

On putty, make sure that you have the Allow agent forwarding box checked and your private key file selected. (Under Connection–>SSH–>Auth).

Note I did a vagrant destroy before doing this. There’s probably a way to do it without having to do that, but I can get everything synced up in a couple commands so I took the easy route.

I wonder if this kind of setup is worth including in the main project since it works on Mac, Linux, AND Windows? Especially allowing for a config file.


Also note that they setup databases, and pull repos and get a fully working instance up and rolling with the first Vagrant up. So if a config file were used, checking out this project could get a user running in one command/step with either

  • A blank default install of Trellis, Bedrock, and Sage ready to be customized

  • Couple changes to a config allows user to checkout an already started customized, private repo and continue working.

I will put together a demonstration on a fork if anyone is interested.

1 Like