Skip to main content

Visual Studio Code

Generating an SSH Key

Generating an SSH key can vary from system to system. To generate an SSH key in a Unix system (Mac and Linux users), you can find instructions in the Unix section here. For Windows users, you can get instructions to generate such a key here.

Setup

Before being able to connect to Elja via VSCode, you'll need to get an extension called "Remote - SSH". To get this, go to the extensions tab in VSCode and type in "Remote - SSH" as shown in the following picture:

Steps to install Remote SSH

Create a Connection

Connect to Host

After installing the extension, click on the button located at the bottom-left corner. Clicking it should display available types of connections. Choose Connect to Host...

Step to connect to Host

Now after clicking on Connect to Host..., it should display Configure SSH Hosts.

Configure SSH

VSCode might specify the file that it wants to use as the SSH config file. If VSCode displays a config file, then select it. If it doesn't or it's not the config file that you want to use, then click on Settings.

In the Settings, there is an input located under Remote.SSH: Config Files (Applies to all profiles) The absolute file path to a custom SSH config file. In that input location, type the path of the config file.

Step to connect to Host

Now go through the whole process again. That is, go to Connect to Host -> Configure SSH Hosts -> SSH config file.

Select the path that VSCode displays, which is the path to the config file that you placed in the input in the configure section and click on it. The configuration file should now be open in VSCode.

Select specific config file

In the configuration file, you'll need to add the information of the host, hostname, your username, and the path to the private key that is used to connect to Elja. This should look something like this:

Host Test
HostName elja.hi.is
User <username>
IdentityFile ~/Full/Path/To/Private/Key

After you've added these lines to the configuration file go ahead and save and exit. An exmaple on how it should be inserted into the configuration file is shown in the picture here below.

Example of adding host to the config file

Connect to Elja

After completing every step from the previous sections, we can finally go through the steps to actually connect to Elja with VSCode.

Click on the green button in the bottom left corner, and select Connect to Host. Now you should see the available hosts that have been retrieved from the configuration file, and you should now be able to see the Elja host. For this example, it is called Test. Click on Test and you should now be connected to Elja.

Example of connecting to host

To verify that you're connected to Elja, simply open up a terminal in that VSCode session and you should see "username@elja-irhpc" in the terminal window.

Elja login via VSCode