Skip to content

Instantly share code, notes, and snippets.

@owendavies93
Created January 29, 2014 15:20
Show Gist options
  • Save owendavies93/8690168 to your computer and use it in GitHub Desktop.
Save owendavies93/8690168 to your computer and use it in GitHub Desktop.
Windows Rails Deployment when SSH keys won't play nicely

Sometimes Windows (via git bash or whatever) won't play ball with OpenSSH, much to my annoyance. This means that most Rails deployment options won't work, because they stupidly rely on SSH keys with no password fall back. However, there is a (slightly hacky) solution thanks to PuTTY, or more specifically plink, which is headless PuTTY.

After setting up keys for an ssh session with PuTTY (which always works with Windows, unlike other solutions), you can run this:

git push production master &&
plink atlee "cd /path/to/app && rake db:migrate && rake assets:precompile && touch tmp/restart.txt

My PuTTY session for the remote server is saved as 'atlee'. Obviously you could make a sick Rakefile and then just run that instead of the individual rake commands. The last command restarts Passenger.

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