Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在windows上使用rsync,vagrant运行CoreOS虚拟机_Windows_Cygwin_Vagrant_Rsync_Coreos - Fatal编程技术网

在windows上使用rsync,vagrant运行CoreOS虚拟机

在windows上使用rsync,vagrant运行CoreOS虚拟机,windows,cygwin,vagrant,rsync,coreos,Windows,Cygwin,Vagrant,Rsync,Coreos,我使用的是运行vagrant和cygwin的rsync的Windows8.1 Pro pc 我正在这样配置: config.vm.synced_folder "../sharedFolder", "/vagrant_data", type: "rsync" 当我执行vagrant up时,我得到以下错误: C:\dev\vagrantBoxes\coreOS>vagrant up Bringing machine 'default' up with 'virtualbox' provid

我使用的是运行vagrant和cygwin的rsync的Windows8.1 Pro pc

我正在这样配置:

config.vm.synced_folder "../sharedFolder", "/vagrant_data", type: "rsync"
当我执行
vagrant up
时,我得到以下错误:

C:\dev\vagrantBoxes\coreOS>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'yungsang/coreos' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: core
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Rsyncing folder: /c/dev/vagrantBoxes/sharedFolder/ => /vagrant_data
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /c/dev/vagrantBoxes/sharedFolder/
Guest path: /vagrant_data
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 StrictHostKeyChecking=no -o UserKnownHostsFile=/d
ev/null -i 'C:/Users/aaron.axisa/.vagrant.d/insecure_private_key' --exclude .vagrant/ /c/dev/vagrantBoxes/sharedFolder/ core@127.0.0.1:/vagrant_data
Error: Warning: Permanently added '[127.0.0.1]:2222' (RSA) to the list of known hosts.
rsync: change_dir "/c/dev/vagrantBoxes/sharedFolder" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at /usr/src/ports/rsync/rsync-3.0.9-1/src/rsync-3.0.9/main.c(1052) [sender=3.0.9]

我认为这是一个如何将目录路径更改为/c/dev而不是c:\dev的问题。有一种黑客方法可以解决这个问题(无论如何对我来说都是有效的),您必须更改它

hostpath = Vagrant::Util::Platform.cygwin_path(hostpath)

C:\HashiCorp\Vagrant\embedded\gems\gems\Vagrant-[VERSION]\plugins\synced\u folders\rsync\helper.rb中的第43行

它与1.5.x不同,您可以在这里阅读有关它的帖子:


然而,我会第一个承认编辑核心远远不够理想。

就像我在github上评论的那样,在你的Vagrant文件中的下面一行肯定会解决你的问题

ENV[“检测到的流浪汉”]=ENV[“检测到的流浪汉”]。发送到+cygwin“


由于这是Vagrant文件中的本地文件,因此可以在我的测试中保持源文件不受影响,如果您使用的是cygwin,请使用@osroot25提供的解决方案

如果您使用的是cwRsync,并且没有cygwin,那么除了将源代码编辑为@Andrew Myers details之外,使用Vagrant没有其他解决方法。使用Vagrant v1.6.5进行测试

我的解决办法是完全绕过流浪汉,直接使用cwRsync。这对我很有用,因为我正在同步一个几乎从不更改的文件夹。我可能会在一天内更改好几次(所以每次我都要记住下面的第2步),但我会在几周(或几个月)内不做任何更改。请记住,要使用cwRsync,必须编辑并使用cwRsync.cmd脚本。尝试直接访问rsync.exe命令或通过将其添加到路径将失败。步骤1:我在cwrsync.cmd的末尾添加了以下行(在已安装的文件夹中):


rsync-re“ssh-p2222”/cygdrive/b/VCS/packages/vagrant@localhost:包--排除“.git/”

步骤2:我打开了一个单独的cmd窗口,使用完整路径运行cwrsync.cmd。然后,如果我需要将更改同步到VM上,我会激活该窗口,向上箭头,返回并立即更新


通过@osroot25修改ENV以设置cygwin fix不适用于cwRsync,因为当您强制检测cygwin时,“vagrant ssh”命令将不起作用,因为它需要cygwin中的cygpath命令,而您没有该命令,因此无法通过ssh连接到VM中。如果您直接使用ssh命令并使用所有正确的选项,那么您可以这样做。

解决方法:只需在cygwin终端上使用
ln-s/cygdrive/c//c

hostpath = "/cygdrive" + Vagrant::Util::Platform.cygwin_path(hostpath)