GCE Remote development via VSCode SSH - MRLIVING/Becca GitHub Wiki

TOC

Overview

Server SSH key generate & setup

ssh-keygen

  • ssh-keygen -t rsa -f ~/.ssh/[KEY_FILENAME] -C [USERNAME], e.g., ssh-keygen -t rsa -f ~/.ssh/becca-ssh-key -C becca,
    and the command will generate 2 keys under ${USER_HOME}/.ssh/

    1. becca-ssh-key
    2. becca-ssh-key.pub

setup the Public key into the GCE via web console

Client Installation (VSCode in Windows)

Install OpenSSH

Download and install Visual Studio Code

Setup remote connection and private key

  • create ~/.ssh/config,

  • update ~/.ssh/config, see SSH configuration file, notice code the config file manually instead of copy/past the content

  • Connect to the remote server

  • Open a remote folder

  • Open a terminal for remote CLI mode

  • Close the remote connection

Git Commit as a different user