LoginSignup
4
3

More than 3 years have passed since last update.

vscodeのRemote Developmentで仮想環境にsshする

Posted at

環境

  • デバイス:Mac
  • 仮想環境:Vagrant Ubuntu
  • エディタ:vscode

プラグイン

  • Remote Development

背景

  • vagrantでは共有フォルダが利用できるが、vscodeでササっと開発がしたかったため、リモートにsshできるプラグインを採用。

設定方法

1.Remote Developmentをインストール
vscodeのExtensionsのアイコンで検索し、インストールしてください。

2.ssh先の設定を確認
vagrantを起動するディレクトリで

$ vagrant ssh-config

こんな感じで表示される

  Host "ホスト名"
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /Users/{USERNAME}/vagrant/ubuntu64_18/.vagrant/machines/default/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL

3..sshに設定を出力させた結果を記述

$ vagrant ssh-config >> ~/.ssh/config

4.vscodeで接続してみる
画面左下に表示される><をクリックするorコマンドパレットでRemote-SSH: Connect to Host
接続先のホスト名を選択し、接続が完了する。
5分もあればできるので、、、楽なのでオススメです( ´_ゝ`)

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3