Skip to content

Instantly share code, notes, and snippets.

@Narayon
Forked from geedew/vagrant-scp
Last active April 8, 2018 01:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Narayon/88c5953c9afdb921d433a41935a88982 to your computer and use it in GitHub Desktop.
Save Narayon/88c5953c9afdb921d433a41935a88982 to your computer and use it in GitHub Desktop.
Copying files from and to a Vagrant VM
#!/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 | grep -v '^Host ' | awk -v ORS=' ' 'NF{print "-o " $1 "=" $2}'`
# copy from host to vagrant
# scp ${OPTIONS} $FILE v:$PATH
copy from vagrant to host
# scp ${OPTIONS} v:$PATH $FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment