Do you need to copy a file to your Vagrant VM?
Unfortunately there's no vagrant scp
command as far as I know. But we can use vagrant ssh
in a pinch:
cat ~/.gitconfig | vagrant ssh -- 'tee ~/.gitconfig'
Do you want to move over multiple files?
# copies ~/FILE1.TXT and ~/FILE2.TXT to /tmp/FILE1.txt and /tmp/FILE2.txt
tar cz --directory ~ FILE1.TXT FILE2.TXT | vagrant ssh -- 'cd /tmp; tar xzf -'
Make sure you understand what the --directory
option to tar does.
vagrant ssh -- -l username
logging to vagrant box using the custom added user
This one I use mostly :)