Skip to content

Instantly share code, notes, and snippets.

@chriswoodle
Created November 15, 2019 19:11
Show Gist options
  • Save chriswoodle/e444cc2a233f619dc4a1759e7435a208 to your computer and use it in GitHub Desktop.
Save chriswoodle/e444cc2a233f619dc4a1759e7435a208 to your computer and use it in GitHub Desktop.
PI + VSCode Remote SSH

Setup VSCode Remote SSH with Raspberry pi

Setup your PI

  1. Enable SSH on your PI
    • From your pi terminal enter the following:
    $ sudo raspi-config
    5 Interfacing Options > P2 SSH > Yes
  2. Connect Raspberry Pi to your network
  3. Obtain the IP Address of your PI
    • From your pi terminal enter the following:
    $ ifconfig
    • If your pi is connected via ethernet find the string eth0 > inet xxx.xxx.xxx.xxx where xxx.xxx.xxx.xxx is your IP
    • If your pi is connected via WIFI find the string wlan0 > inet xxx.xxx.xxx.xxx

Setup VSCode

  1. From your computer on the the same network, download and install VSCode.
  2. In VSCode, open the Extensions pane on the left side. Install Remote - SSH by Microsoft.
  3. Once installed, there will be a new icon on the left side called Remote Explorer. From that panel, add a new SSH Target. Enter pi@xxx.xxx.xxx.xxx
  4. Then select the first option to store that settings.

Connect to pi

  1. From the Remote Explorer panel in vscode, click the folder icon next to the new list item. It will then open a new VSCode window.
  2. The first time you connect select continue by pressing enter to save the PI's RSA key. (This key is a generated key that is stored on the PI, and acts a a security mechanism)
  3. Enter your PI's user 'pi' password. The default is raspberry.
  4. Then select Open Folder and you will be able to browse the PI's filesystem.
  5. If you open the integrated terminal, it will be opened on the pi and not your local computer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment