No laravel sync folders in homestead vagrant on windows

4.7k Views Asked by At

i installed vagrant lately on my windows 7 machine, i successfully runned the virtual machine because i can ssh to it but no synchronization between my local project and the homestead.

my yaml file is like :

ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: /Users/User/Homestead/projects
      to: /home/vagrant/sites

sites:
    - map: laravel.dev
      to: /home/vagrant/sites/laravel/public
      hhvm: true

databases:
    - homestead

variables:
    - key: APP_ENV
      value: local

My laravel project is inside projects folder in my local homestead directory, but it seems that the sites folder that links to it is not synced with it !!

i'm not good at unix command line but is it weird that ls -la command work but ls alone don't seem to work as i saw if tutorials ?

enter image description here

update :

After changing the hosts file setup for : 127.0.0.1 laravel.dev to 192.168.10.10 laravel.dev the site was accessible in my browser, but the problem of no syncronization still happening (i had to install a new laravel in vangrant) i want to deplay my project from wamp to projects folder and be syncronized with "sites" in homestead

3

There are 3 best solutions below

1
On BEST ANSWER

Edit your Homestead.yaml In the line

---

 folders:
   - map: E:/projects //your projects folder here
    to: /home/vagrant/Code

 sites:
   - map: homestead.app
   to: /home/vagrant/Code/Laravel/public

Now if you are using Windows, open notepad as administrator and your hosts

  System32/drivers/etc/hosts


  192.168.10.10 laravel5angularapp.dev
  192.168.10.10 angular2laravel.dev
  192.168.10.10 laravel5-angular2.dev
  192.168.10.10 yourproject.dev

Now access your homestead

 homestead up
 homestead ssh

Inside homestead

 cd Code
 ls -a

All your projects should appear here, then

cd ~

then

serve yourproject.dev /home/vagrant/Code/yourlaravelprojectname/public/

Then

sudo service nginx restart

Or

homestead reload

Your project should be running in

http://yourproject.dev
0
On

You can use ~/Homestead/projects in windows is the same the C:\Users\your_user\your_folders

1
On

I've tried many things but none of them worked. Finally i've changed map folder to the full path version and then run the vagrant reload command and it was ok.

Homestead.yaml

folders:
- map: C:/Users/username/Code
  to: /home/vagrant/Code.

vagrant reload