gpt4 book ai didi

windows - 如何在 Windows 上的 Vagrant 中使用 rsync 共享文件夹?

转载 作者:可可西里 更新时间:2023-11-01 10:46:24 24 4
gpt4 key购买 nike

我想使用 Vagrant 在本地开发 WordPress 网站(主机:Windows 8 64 位;访客:Ubuntu 12.04 LTS)。我正在使用 Chris Wiegman 的 Primary Vagrant (Apache 版本的 VVV)

我让它运行起来了,但是一旦我添加了我的所有文件,网站就运行得非常慢。经过研究,我猜这是因为共享文件夹运行缓慢。 this blog post on the Vagrant website 中提到的解决方法,就是使用rsync。

尽管他们没有关于如何在 Windows 上运行 rsync 的说明,但我遇到了 this article推荐免费版本的 cwrsync。我还必须添加路径环境变量,以便 rsync 在 Windows 上的所有文件夹中工作(this answer 对此有所帮助)

我编辑了 vagrant 文件,以便通过将 ,"rsync", rsync__exclude: ".git/" 附加到 Primary Vagrant vagrant file 来使用 rsync :

config.vm.synced_folder "sites/stable.wordpress.vagrant", "/var/www/stable.wordpress.vagrant", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ],"rsync", rsync__exclude: ".git/"
config.vm.synced_folder "sites/stable.wordpress.vagrant/uploads", "/var/www/stable.wordpress.vagrant/wordpress/wp-content/uploads", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ],"rsync", rsync__exclude: ".git/"
config.vm.synced_folder "sites/trunk.wordpress.vagrant", "/var/www/trunk.wordpress.vagrant", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ],"rsync", rsync__exclude: ".git/"
config.vm.synced_folder "sites/trunk.wordpress.vagrant/uploads", "/var/www/trunk.wordpress.vagrant/wordpress/wp-content/uploads", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ],"rsync", rsync__exclude: ".git/"
config.vm.synced_folder "sites/Search-Replace-DB", "/var/www/replacedb.vagrant", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ],"rsync", rsync__exclude: ".git/"
config.vm.synced_folder "sites/phpmyadmin", "/var/www/phpmyadmin.vagrant", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ],"rsync", rsync__exclude: ".git/"
config.vm.synced_folder "sites/webgrind", "/var/www/webgrind.vagrant", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ],"rsync", rsync__exclude: ".git/"

然后我做了一个vagrant up --provision。但不幸的是,我收到以下错误消息。尽管试图在网上找到问题,但我做不到。

错误信息如下:

==> default: Rsyncing folder: /cygdrive/c/Users/IanAnderson/Documents/Sites/Vagrants/Primary-Vagrant/vagrant-local/sites
/stable.wordpress.vagrant/ => /var/www/stable.wordpress.vagrant
==> default: - Exclude: [".vagrant/", ".git/"]
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.
Host path: /cygdrive/c/Users/IanAnderson/Documents/Sites/Vagrants/Primary-Vagrant/vagrant-local/sites/stable.wordpress.v
agrant/
Guest path: /var/www/stable.wordpress.vagrant
Command: rsync --verbose --archive --delete -z --chmod=ugo=rwX --no-perms -e ssh -p 2222 -o StrictHostKeyChecking=no -i
'C:/Users/IanAnderson/.vagrant.d/insecure_private_key' --exclude .vagrant/ --exclude .git/ /cygdrive/c/Users/IanAnderson
/Documents/Sites/Vagrants/Primary-Vagrant/vagrant-local/sites/stable.wordpress.vagrant/ vagrant@127.0.0.1:/var/www/stabl
e.wordpress.vagrant
Error: Warning: Permanently added '[127.0.0.1]:2222' (RSA) to the list of known hosts.
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [Receiver=3.0.9]
rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(759) [sender=3.0.6]

最佳答案

尝试使用 MinGW .它在 /bin 中自带 ssh.exe 和 /msys/<version_number>/bin 中的 rsync.exe .将这些目录添加到我的 PATH 使其在我的机器上运行。

关于windows - 如何在 Windows 上的 Vagrant 中使用 rsync 共享文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23337312/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com