Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.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
Ssh 主机上的文件更改未使用vagrant/virtualbox在来宾计算机上镜像_Ssh_Vagrant_Virtualbox - Fatal编程技术网

Ssh 主机上的文件更改未使用vagrant/virtualbox在来宾计算机上镜像

Ssh 主机上的文件更改未使用vagrant/virtualbox在来宾计算机上镜像,ssh,vagrant,virtualbox,Ssh,Vagrant,Virtualbox,我目前正在关注Semmy Purewal的书《学习Web应用程序开发》。在本书的当前部分,我正在学习如何使用VirtualBox和vagrant在自己的计算机上托管一台服务器,然后使用ssh连接到其中。根据这本书,主机的vagrant目录中的任何文件也应该镜像到home/vagrant目录中的来宾机上,反之亦然。直到最近,情况依然如此,一切都很顺利 但是,现在,当我尝试在主机上的文本编辑器中编辑文件并保存它们时,这些更改在ssh到来宾计算机中时不会反映出来。即使在重新连接、重新启动vagrant

我目前正在关注Semmy Purewal的书《学习Web应用程序开发》。在本书的当前部分,我正在学习如何使用VirtualBox和vagrant在自己的计算机上托管一台服务器,然后使用ssh连接到其中。根据这本书,主机的vagrant目录中的任何文件也应该镜像到home/vagrant目录中的来宾机上,反之亦然。直到最近,情况依然如此,一切都很顺利

但是,现在,当我尝试在主机上的文本编辑器中编辑文件并保存它们时,这些更改在ssh到来宾计算机中时不会反映出来。即使在重新连接、重新启动vagrant,甚至重新启动我的计算机后,情况也是如此

有人知道为什么会这样吗?对不起,这是一个新手问题,但从我正在读的书中可以看出,我对所有这些东西都是新手。非常感谢您的帮助

提前感谢,

保罗

编辑:这是我运行Wagrant up时的输出:

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> 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: 3000 => 3000 (adapter 1)
default: 22 => 2222 (adapter 1)
==> 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: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version o
f
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you
see
default: shared folder errors, please make sure the guest additions within t
he
default: virtual machine match the version of VirtualBox you have installed
on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.2.0
default: VirtualBox Version: 4.3
==> default: Mounting shared folders...
default: /vagrant => C:/Users/paul/Projects/Chapter6
default: /home/vagrant/app => C:/Users/paul/Projects/Chapter6/app
default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks => C:/Users/paul/Projects
/Chapter6/cookbooks
==> default: Machine already provisioned. Run `vagrant provision` or use the `--
provision`
==> default: to force provisioning. Provisioners marked to run always will still
run.

这正是我想要的结果:第6章的文件夹被装载并在主机和客户机上共享。唯一的问题是它实际上没有同步。。。例如,/Chapter6中有一个名为“server.js”的文件,我最近更新了该文件,如果主机上的I
cat
,它将显示新版本,而来宾计算机上的
cat
将显示旧版本。有什么帮助吗?

标准设置是使用Virtualbox的共享文件夹。默认情况下,它安装在guest上的/vagrant(假设它是*nix guest)


如果没有挂载/vagrant文件夹,则在通过
vagrant up
启动vm时,您可能应该关注输出。它将在装载共享文件夹时输出日志消息。

Jahaja,感谢您的评论。是的,当我运行
vagrant up
然后运行
vagrant ssh
时,我会在主机上的“vagrant”目录中结束。查看
vagrant up
的日志似乎没有发现任何问题,有关相关输出,请参阅我上面的编辑。我在哪里可以找到具体的问题?通常登录时您不会在/vagrant目录中结束,而是在默认情况下在vagrant users home目录中结束(/home/vagrant)。您可以通过
pwd
命令查看当前所在的目录。若要更改为共享文件夹目录-假定它有效-请键入
cd/vagrant
。jahaja,我不确定是否遵循。。。在这两种情况下,你都提到我在流浪者名录中没有?如果我想查看我结束的完整目录,它是home/vagrant。这不是你最初提到的流浪者目录吗?不,
/home/vagrant
是流浪者用户的home目录。您要查找的文件夹应位于
/vagrant
<代码>cd/vagrant更改为它。好的,我更改为它。我应该找什么?我只是不确定这将如何帮助回答我的问题。