Connect Visual Studio Code with Vagrant in your local machine
When we working with vagrant many times we need an IDE to make our work easier, for example I use Visual Studio Code, and to program I use Vagrant with Ubuntu server and here I will show you the configuration to connect them:
- In your terminal type
$ vagrant up
for initialize your Vagrant
2. Type $ vagrant ssh-config
this will output valid configuration for an SSH config file to SSH into the running Vagrant machine from ssh
directly (instead of using vagrant ssh
) copy that.
3. Now in vs code install the extension Remote-SSH
4. In the lower left corner we click on the arrows, then we select Remote-ssh: Open configuration file we paste the configuration that we copied in step 2 (we can change host name).
5. Select our connection on remote explorer and connect with vagrant.
Now we can work in vagrant from vs code!
For more information: