【问题标题】:How to sync folder with Vagrant in Windows?如何在 Windows 中将文件夹与 Vagrant 同步?
【发布时间】:2017-05-25 01:28:18
【问题描述】:

在 Windows 10 上使用 Vagrant 1.9.2。

chololatey安装rsync:

C:\> choco install rsync

Vagrantfile:

Vagrant.configure("2") do |config|
  ...
  config.vm.synced_folder "data", "/vagrant"
  ...
end

这里想将当前路径下的data文件夹同步到Vagrant中的/vagrant路径。当登录到 Vagrant 并在/vagrant 路径下创建一个test 文件时,从 Windows 的data 文件夹中检查,没有任何内容。所以文件没有同步。为什么?如何同步?


编辑

今天开始流浪,有新问题:

There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /c/Users/me/data/
Guest path: /vagrant
Command: "rsync" "--verbose" "--archive" "--delete" "-z" "--copy-links" "--chmod=ugo=rwX" "--no-perms" "--no-owner" "--no-group" "--rsync-path" "sudo rsync" "-e" "ssh -p 2222 -o LogLevel=FATAL   -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i 'C:/Users/me/.vagrant/machines/default/virtualbox/private_key'" "--exclude" ".vagrant/" "/c/Users/me/data/" "vagrant@127.0.0.1:/vagrant"
Error: rsync: change_dir "/c/Users/me/data" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178) [sender=3.1.2]

【问题讨论】:

    标签: windows vagrant


    【解决方案1】:

    我使用nfs类型解决了问题:

    config.vm.synced_folder "data", "/vagrant", type: "nfs"
    

    【讨论】:

    • 但是...NFS folders do not work on Windows hosts. Vagrant will ignore your request for NFS synced folders on Windows.
    猜你喜欢
    • 2016-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-18
    • 2016-03-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多