How to copy file from a Vagrant machine to localhost

后端 未结 7 534
隐瞒了意图╮
隐瞒了意图╮ 2021-01-30 13:53

I want to copy a local file from a Vagrant machine to my localhost, but I am getting an error message:

ssh: connect to host 127.0.0.1

7条回答
  •  情话喂你
    2021-01-30 14:14

    As @SevenJ mentioned, ssh-config can provide all the info you need. But it's a lot easier to save it to a file and use that file, rather than constructing a complicated scp command. E.g.:

    vagrant ssh-config > config.txt
    scp -F config.txt default:/path/to/file .
    

    Here I'm assuming your vagrant file doesn't override the machine name from "default". If it does, replace "default:" with ":".

提交回复
热议问题