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

前端 未结 19 1620
暖寄归人
暖寄归人 2020-12-22 15:15

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 (Pup

19条回答
  •  有刺的猬
    2020-12-22 15:41

    Instead of using a shell provisioner to copy the file, you can also use a Vagrant file provisioner.

    Provisioner name: "file"

    The file provisioner allows you to upload a file from the host machine to the guest machine.

    Vagrant.configure("2") do |config|
      # ... other configuration
    
      config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
    end
    

提交回复
热议问题