问题:
I have a use case where I occasionally want to copy a single file from my host machine to the Vagrant guest.我有一个用例,我偶尔想将单个文件从我的主机复制到 Vagrant 来宾。
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.我不想通过传统的供应商(Puppet/Chef)这样做,因为这通常是一次性的——我只想快速添加一些东西到我的 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.当我只想复制一个文件时,编写一个 shell 配置脚本并处理潜在的转义似乎也有点过头了。
So, what's the easiest way to copy a single file from host to guest?那么,将单个文件从主机复制到来宾的最简单方法是什么?
解决方案:
参考一: https://stackoom.com/question/185UJ参考二: Easiest way to copy a single file from host to Vagrant guest?