When working with vagrant and logging into the VM with
vagrant ssh, you will start in the usual home directory of the vagrant user. But in a usual project you want to start in the root of your project. One option to achive this is to add extra arguments to the
Vagrantfile configuration and put in a command to change directory to the path you want to go to:
config.ssh.extra_args = ["-t", "cd /var/www/your-project/current; bash --login"]
You will just have a problem when you're running commands directly to vagrant ssh, for example:
vagrant ssh "php bin/console doc:mig:mig -n"
This won't work anymore. The other variant would be to add the same change directory command to the bash configuration:
[[ ! `grep "cd /var/www/your-project/current" /home/vagrant/.bashrc` ]] && echo "cd /var/www/your-project/current" >> /home/vagrant/.bashrc