Link

System Setup

Installing Git, generating SSH keys, and configuring IntelliJ.

Table of contents

  1. Java
  2. Git
  3. SSH Keys
    1. Generate a new SSH key pair
    2. Add the SSH key to your GitLab account
  4. IntelliJ
    1. Configuring Checkstyle
    2. Getting Your Repository
    3. Importing the Project
    4. Adding the Skeleton Remote

There’s a lot to setup, and it can be frustrating if things aren’t working. Setup can be a bit finicky because different computers behave in different ways. This setup procedure is fairly tedious, but luckily we only need to do it once and it’ll save us time for future homework assignments.

If something doesn’t look right, come to office hours starting Fri, Sep 27 and we can work together to figure it out. You can also let us know about any problems by either making a new Piazza question or following-up to the Setup thread.

Tip
The more relevant details we can get about the problem, the better. Include the setup step that’s causing trouble, a summary of the problem, as well as what you expected to see. A screenshot can also be helpful.

Java

All of the homeworks in this course will use Java JDK 11. Install OpenJDK 11 (LTS) with HotSpot. If your computer already has JDK 11 (or newer), then you can skip this step.

Git

Git is a version control system (VCS): a tool for tracking changes between versions of code and sharing those changes with other people. A VCS allows us to not only see changes from old code, but also revert back to older versions and manage many different team members contributing to a project at the same time. All of this information about our code and its history is stored together in one unit called a repository (repo). It’s a data structure that represents all of our work.

You may have heard of GitHub before. GitHub is an online platform for storing and managing backups of our Git repositories.

In this course, we will be using CSE GitLab, a CSE-supported alternative to GitHub. While your Git repository works locally, keeping it backed up on CSE GitLab not only makes it convenient to find past versions of your work in case your computer crashes, but it also simplifies the process for turning in homework.

macOS comes with Git included, and Linux users can install git from their package manager.

Windows users need to install Git manually.

Download and install Git for Windows.

All of the default settings are acceptable for this course. You can choose different settings if you have a particular preference. If you do intend to change any preferences, make sure to leave Configuring the line ending conversions to the default option, Checkout Windows-style, commit Unix-style line endings, to ensure compatibility with our Linux-based (Unix-style) autograders.

SSH Keys

SSH keys fill the same role as a username and password: we use them to authenticate our digital identity with a service. SSH keys can be thought of as very long, randomly generated, unique identifiers that serve as both your username and your password. Many programming tools prefer to use SSH keys because they are extremely difficult to be guessed or broken.

Since SSH keys are very long, we don’t actually type in SSH keys with a keyboard. Instead, your computer will store your SSH key and automatically send it to a service when you need to authenticate. When all setup, authenticating with SSH keys are usually faster than using a username and password because you don’t need to enter the details every time.

Generate a new SSH key pair

If you already have an SSH key pair, you can use that if you prefer.

  1. Open a terminal on Linux or macOS, or Git Bash on Windows.
  2. Generate a new ED25519 SSH key pair with your @uw.edu email.
    ssh-keygen -t ed25519 -C "YOUR_UW_NETID@uw.edu"
    
  3. Next, you will be prompted to input a file path for your SSH key pair. Accept the defaults by pressing Enter on your keyboard.
  4. Once the path is decided, you will be prompted to input a password to secure your new SSH key pair. It’s a best practice to use a password, but it’s not required and you can skip creating it by pressing Enter twice.

Add the SSH key to your GitLab account

  1. Copy your public SSH key (filename ending in pub) to the clipboard by using one of the commands below depending on your Operating System:
    • macOS:
      pbcopy < ~/.ssh/id_ed25519.pub
      
    • Linux (requires the xclip package):
      xclip -sel clip < ~/.ssh/id_ed25519.pub
      
    • Git Bash on Windows:
      cat ~/.ssh/id_ed25519.pub | clip
      
  2. Visit your CSE GitLab account at gitlab.cs.washington.edu.
  3. Navigate to the SSH Keys by tapping on your avatar in the upper right corner and selecting Settings. Paste your public key into the Key field. Give it a title if it doesn’t have one already. Then, tap Add key.

IntelliJ

IntelliJ is the integrated development environment (IDE) that we’ll be using in this course. If you’ve used jGRASP before, IntelliJ is its real-world, production-ready equivalent.

Download and install IntelliJ Community Edition. Open IntelliJ after installation is finished. During the first startup, IntelliJ will ask you to configure some editor settings. You can Skip Remaining and Set Defaults, or choose a color scheme and continue.

IntelliJ Welcome

After the initial setup steps are complete, you’ll be greeted by the welcome window. In the “Welcome to IntelliJ IDEA” window, tap the Configure dropdown in the bottom right corner and choose the Plugins menu item. From the “Plugins” window, we’ll need to install two plugins: Java Visualizer and Checkstyle-IDEA. After installing both plugins, restart IntelliJ.

IntelliJ Plugin Search

Configuring Checkstyle

Once IntelliJ has finished restarting, we’ll need to setup the Checkstyle plugin with CSE 373-specific settings.

From the welcome window, tap the Configure dropdown again but this time choose the Settings (Preferences on macOS) menu item. In the sidebar, tap on the Checkstyle item at the bottom of the list. From here, we have a few things to do.

  1. Change the Scan Scope dropdown in the top right to Only Java sources (including tests).
  2. Add the CSE 373 checkstyle configuration. Tap the + icon on the right side under Configuration File section. In the window that appears, enter a description like “CSE 373 Checks”. Then, select Use a Checkstyle file accessible via HTTP and paste the following address.

     https://courses.cs.washington.edu/courses/cse373/19au/files/cse373-checkstyle-rules.xml
    
  3. Back in the Checkstyle settings, mark the checkbox next to “CSE 373 Checks” to enable it. Finally, tap OK to apply the updated settings.

IntelliJ Checkstyle

Getting Your Repository

Now that the initial IntelliJ setup is done, we can download a copy of the homework by cloning your personal CSE GitLab repository.

First, let’s make sure that you have access to your personal repository. Visit the CSE 373 Autumn 2019 Students group, login with your UW NetID, and you’ll be greeted by four repositories: data, library, skeleton, and a repository named after your UW NetID. This named repository is your personal repository. Your personal repository should already have some files and folders inside including the skeleton code for the first homework assignment, intlist.

Tap the blue Clone button and copy the Clone with SSH Git address. This should look like the following address except named after your UW NetID.

git@gitlab.cs.washington.edu:cse373-19au-students/YOUR_UW_NETID.git

GitLab Clone

In the IntelliJ welcome window, tap on the Get from Version Control. Paste the Git address from earlier and choose a directory to store your personal repository. Once IntelliJ finishes cloning your repository, a new window will ask if you want to create or import a new project from this repository. Tap Yes to accept.

Importing the Project

IntelliJ will present a series of dialog windows walking you through the import process to confirm that you’re happy with its autodetected system setup. Leave all of the settings to their defaults and accept each window. Overwrite when prompted.

After you’ve imported your personal repository as a new project, IntelliJ will bring you to its editor. All that’s left is to add the skeleton repository as a remote. This will allow IntelliJ to download updates to this homework and download future homeworks at the touch of a button.

Adding the Skeleton Remote

From the editor menu bar, tap VCS, hover over the Git item, and tap Remotes… to bring up a dialog window where we can add the skeleton repository as a remote. Name the remote skeleton and use the following address.

git@gitlab.cs.washington.edu:cse373-19au-students/skeleton.git

IntelliJ Git Remotes


Phew, that’s it! Next, follow the Using IntelliJ quick start guide to introduce yourself to the software we’ve just installed.