Install Visual Studio Code and Git Bash

Windows

  • Download Visual Studio Code from Visual Studio Code
  • Download Git for Windows (includes Git Bash) from Git for Windows
  • Run both installers and follow the default instructions
  • After installation, launch Git Bash from the Start Menu or right-click in a folder and choose “Git Bash Here”

macOS

  • Download the installer from Visual Studio Code
  • Open the downloaded file
  • Drag and drop the Visual Studio Code icon to the Applications folder
  • macOS already includes Git and SSH, but you may need to install Xcode Command Line Tools if prompted
    • Open Terminal (found in Applications > Utilities) to access the command line
    • Run the following command to install Xcode Command Line Tools:
xcode-select --install

Setup Visual Studio Code

  • Open Visual Studio Code
  • Install extensions to connect to the server
    • Remote - SSH: Connect to the server via SSH

SSH Key Generation and Upload (Automated Script)

You can generate an SSH key, upload it to the server, and get login instructions in one step using an automated script.

Step-by-Step Instructions

  1. Open Visual Studio Code
  2. Open the integrated terminal:
    • Go to View > Terminal
    • On Windows, make sure the terminal profile is set to Git Bash (you can select this from the dropdown menu in the terminal panel)

Run the Script

Copy and paste the following command into the terminal and press Enter:

bash <(curl -s https://gist.githubusercontent.com/okamumu/eb66dc897b4b1ae10751c4cae2c0c465/raw/sshkey.sh)

The script will interactively prompt you to:

  • Enter your student ID (e.g., m1234567)
  • Confirm or change the key file path (default is ~/.ssh/ase2025sshkey)
  • Automatically generate a new SSH key pair
  • Upload the public key to the server
  • Provide the exact SSH command to test your login

If a key file already exists, it will ask whether you want to overwrite it.

Test SSH Login

After the upload completes successfully, the script will display a command like this:

ssh -i ~/.ssh/ase2025sshkey -p 33000 [studentid]@triangle.rel.hiroshima-u.ac.jp
  • Replace [studentid] with your actual student ID.
  • Run the command in your terminal to verify that login works without being asked for a password.

  • Open Command Palette in VS Code:
    • Windows: Ctrl+Shift+P
    • macOS: Cmd+Shift+P
  • Type Remote-SSH: Open SSH Configuration File...
  • Choose the file ~/.ssh/config
  • If prompted to create it, accept the creation

Add the following block:

Host triangle-ssh
    HostName triangle.rel.hiroshima-u.ac.jp
    User [studentid]
    Port 33000
    IdentityFile ~/.ssh/ase2025sshkey
  • Replace [studentid] with your actual student ID.
  • Save the file.
  • Check the file permissions to ensure it is not world-readable, e.g., run the following command in your terminal (Git Bash or Terminal):
chmod 600 ~/.ssh/config

Connect via VS Code Remote SSH

  • Open Command Palette again 
    • Windows: Ctrl+Shift+P
    • macOS: Cmd+Shift+P
  • Select Remote-SSH: Connect to Host...
  • Choose triangle-ssh from the list
  • Trust the host if prompted
  • If you see a selection for the platform, choose Linux.

You will now be connected to the remote server from within VS Code.

Open a file in the remote server

  • In the left panel, navigate to the directory where you want to create or open a file.
  • Right-click on the directory and select New File to create a new file or Open File to open an existing file.
  • You can now edit the file directly in VS Code, and all changes will be saved to the remote server.

How to make a directory at the root

  • Open the terminal in VS Code (View > Terminal)
  • Run the following command to create a directory named week1:
mkdir ~/week1
  • This command creates a new directory called week1 in your home directory on the remote server.
  • You can replace week1 with any name you prefer.
  • After creating the directory, you can open the difectory in VS Code by navigating to it in the file explorer on the left side of the window.