Find what port Vagrant is connected to by running
The output Will look as follow:
The forwarded ports for the machine are listed below. Please note that
these values may differ from values configured in the Vagrantfile if the
provider supports automatic port collision detection and resolution.
22 (guest) => 2200 (host)
Indicating that Vagrant is running on port 2200
Get the absolute path for the file that you want to copy i.e.
You can get it by ssh’ing into the machine and locating the needed file
Make sure you are in your host machine and use SCP command to copy over the file
-Ppoints to port from step 1
- username is vagrant
- Your password, is most likely
- IP is 127.0.0.1 which is just your localhost
- There is a
:after the IP and before the path to the file
- There is a space and
.after the path of the file, indicating that you want to save the file into the current directory.
You can use the same trick to ssh into vagrant the machine (instead of the built in
vagrant ssh command) by running
ssh -p 2200 email@example.com with he only difference being that
-p for port is lower case.