Laravel Homestead using both Windows and Mac

Refresh

November 2018

Views

161 time

2

Following Laravel's 5.1 documentation about using Homestead on a per-project basis, I ran the commands to create a Homestead Vagrantfile inside of my Git repository for my project, I did this on my Macbook. Here is the Homestead.yaml for that:

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
hostname: projectname
name: projectname
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: "/Users/user/Sites/personal/projectname"
      to: "/home/vagrant/projectname"

sites:
    - map: homestead.app
      to: "/home/vagrant/projectname/public"

databases:
    - projectname

variables:
    - key: APP_ENV
      value: local

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# ports:
#     - send: 93000
#       to: 9300
#     - send: 7777
#       to: 777
#       protocol: udp

Problem is, after pushing this to Git and pulling down on my PC, the path in the Homestead.yaml file is now completely wrong so that it won't work...

How can I abstract the path from Homestead.yaml to an environment variable so that I can share a vagrant VM across operating systems?

1 answers

4

Удалось решить эту проблему!

Если установить папку , "."он будет использовать текущий каталог , который работает как для Mac и Windows!

...

folders:
    - map: "."
      to: "/home/vagrant/projectname"

...

Значение теперь у меня есть Homestead бродячей машины в Git, что я могу использовать как на Mac и Windows: D