Howto::VScode: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 22: | Line 22: | ||
* Use VS code to edit the '''remote''' file: ~/.ssh/authorized_keys (if this is your first time, then you might have to create it as a new text file) | * Use VS code to edit the '''remote''' file: ~/.ssh/authorized_keys (if this is your first time, then you might have to create it as a new text file) | ||
** Alternately, you use the command line to SSH into rlogin.cs.vt.edu and edit the file directly using the command `nano ~/.ssh/authorized_keys` | ** Alternately, you use the command line to SSH into rlogin.cs.vt.edu and edit the file directly using the command `nano ~/.ssh/authorized_keys` | ||
== Troubleshooting == | |||
* It is common to run into issues with vscode and remote SSH | |||
* First try resetting the remote side by issuing the VS code command (ctrl-shift-p): "Remote-SSH: Kill VS Code Server on Host..." |
Revision as of 15:20, 31 March 2022
Introduction
Visual Studio Code (vscode) is an increasing popular way of developing software on rlogin.cs.vt.edu. With the appropriate plugin, it will allow you directly edit your files on rlogin.cs.vt.edu and make it easy to get a terminal to run and test your code. These instructions are geared toward the Windows version of vscode, but should be easily adaptable to other operation systems. These instruction also assume that you already have the latest version of vscode installed locally.
Plugin installation and configuration
- Make sure you also have an SSH client: https://code.visualstudio.com/docs/remote/troubleshooting#_installing-a-supported-ssh-client
- Click on the "Gear" icon and select "Extensions" OR push <ctr>-<shift>-x
- Search for "Remote - SSH"
- Click the "Install" button
- This should give you a small green button (bottom left) with "><" icon
- Click on the green button and select "Connect to host..."
- Select "+ Add New SSH Host..."
- Type in "<username>@rlogin.cs.vt.edu -A" change <username> to your CS username
- It should give you a dialog saying the host was added and a button to "Connect"
- When you first connect it will ask you what platform the host is, select "Linux"
- It will also likely ask for your password unless you already have a SSH key set up
- Once connected, the green button should update with "SSH: rlogin.cs.vt.edu" letting you know you are connected remotely
Set up SSH key authentication
- Setting up a public/private key will save you from having to enter your password so many times while using vscode
- While inside VS Code, hit <ctrl>-o to open a file, open the local file: "c:\Users\<username>\.ssh\id_rsa.pub" If this file does not exist, then you can run "ssh-keygen" from the command to generate the file
- Copy the whole contents of this file
- Use VS code to edit the remote file: ~/.ssh/authorized_keys (if this is your first time, then you might have to create it as a new text file)
- Alternately, you use the command line to SSH into rlogin.cs.vt.edu and edit the file directly using the command `nano ~/.ssh/authorized_keys`
Troubleshooting
- It is common to run into issues with vscode and remote SSH
- First try resetting the remote side by issuing the VS code command (ctrl-shift-p): "Remote-SSH: Kill VS Code Server on Host..."