Skip to content

Instantly share code, notes, and snippets.

@mykter
Forked from geedew/vagrant-scp
Last active May 31, 2018 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mykter/2d1589d401e72de67c94 to your computer and use it in GitHub Desktop.
Save mykter/2d1589d401e72de67c94 to your computer and use it in GitHub Desktop.
Copy a file between a Vagrant VM and the host with scp
#!/bin/sh
# Change these settings to match what you are wanting to do
FILE=/File/To/Copy
PATH=/Where/To/Put/File
OPTIONS=`vagrant ssh-config | awk -v ORS=' ' 'NF{print "-o " $1 "=" $2}'`
# To copy a file from a Vagrant VM to the host:
# scp ${OPTIONS} v:$FILE $PATH
# To copy a file from the host to a Vagrant VM:
scp ${OPTIONS} $FILE v:$PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment