Jamesking56 Jamesking56 - 1 year ago 87
Git Question

Laravel Homestead using both Windows and Mac

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: ""
memory: 2048
cpus: 1
hostname: projectname
name: projectname
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

- ~/.ssh/id_rsa

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

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

- projectname

- 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?

Answer Source

Managed to solve it!

If I set the folder to "." it will use the current directory which works for both Mac and Windows!


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


Meaning now I have a Homestead vagrant machine in Git that I can use on both Mac and Windows :D

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download