Easiest way to copy a single file from host to Vagrant guest?

I have a use case where I occasionally want to copy a single file from my host machine to the Vagrant guest.

I don’t want to do so via traditional provisioners (Puppet / Chef) because this is often a one-off — I just want something quick to add to my Vagrantfile.

I don’t want to share an entire directory, possibly because I want to overwrite an existing file without nuking an entire directory on the guest.

It also seems a bit overkill to write a shell provisioning script, and deal with potential escaping, when all I want to do is copy a file.

So, what’s the easiest way to copy a single file from host to guest?

19 Answers
19

Leave a Comment