Difference between revisions of "SSH Using VS Code"

From UFRC
Jump to navigation Jump to search
Line 16: Line 16:
  
 
==Step 3: Connect to the remote server==
 
==Step 3: Connect to the remote server==
Now that your SSH key is configured, you can connect to the remote server using VS Code. To do this, follow these steps:
+
Now that your SSH key is configured, you can connect to HPG using VS Code. To do this, follow these steps:
 
#Press Ctrl + Shift + P (Windows) or Command + Shift + P (Mac) to open the command palette
 
#Press Ctrl + Shift + P (Windows) or Command + Shift + P (Mac) to open the command palette
 
#Type "Remote-SSH: Connect to Host..." and select it from the list
 
#Type "Remote-SSH: Connect to Host..." and select it from the list

Revision as of 18:42, 30 March 2023

This guide will walk you through the process of using SSH in Visual Studio Code (VS Code) to remotely connect to HiPerGator, using an SSH key.

You can install VSCode at this page.

Step 1: Install the Remote Development extension

The first step is to install the "Remote Development" extension in VS Code, which can be done here.

Reload if necessary after it finishes installing.

Step 2: Configure the SSH key

Next, you'll need to configure the SSH key that you created earlier. To do this, follow these steps:

  1. In VSCode, press Ctrl + Shift + P (Windows) or Command + Shift + P (Mac) to open the command palette
  2. Type "Remote-SSH: Open Configuration File..." and select it from the list
  3. If you have not used the Remote Development extension before, you will be prompted to choose a "Connection Type". Choose "SSH".
  4. This will open a file called "ssh_config". Scroll down to the "Host" section and add lines mentioned in SSH Configuration if you haven't already.
  5. Save the file and close it.

Step 3: Connect to the remote server

Now that your SSH key is configured, you can connect to HPG using VS Code. To do this, follow these steps:

  1. Press Ctrl + Shift + P (Windows) or Command + Shift + P (Mac) to open the command palette
  2. Type "Remote-SSH: Connect to Host..." and select it from the list
  3. Select hpg from the list of hosts (the name you specified in the "Host" section of your ssh_config file)
  4. If this is the first time you're connecting to the remote server, you'll be prompted to confirm the server's fingerprint. Check the fingerprint against the server's known fingerprint and select "Yes" to continue.
  5. If prompted, enter your SSH key passphrase
  6. Wait for the connection to be established. This may take a few seconds.
  7. Visual Studio Code will connect to the remote server via SSH and open a new window in which you can edit files and run commands on the server.

Step 4: Open a Remote Workspace

Once connected to the remote machine, you can open a remote workspace by clicking on the "Open Folder" button in the Remote Explorer panel and selecting a folder on the remote machine.