Installing Git, generating SSH keys, and configuring IntelliJ.
- SSH Keys
Setup can be a bit finicky because different computers behave in different ways but, luckily, we only need to do it once and save time on future assignments.
If something doesn’t look right, come to office hours. You can also let us know about any problems by posting to the Campuswire Class Feed.
- 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.
All of the programming homework assignments 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 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. 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 are very long, randomly-generated unique identifiers that serve as both your username and your password. We will use SSH keys to authenticate our digital identity with CSE GitLab. Many programming tools prefer to authenticate with 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 use it when necessary. Once setup, authentication with SSH keys is usually faster than using a username and password because you don’t need to enter the details every time.
If you already have an SSH key pair, you can use that if you prefer.
- Open a terminal on Linux or macOS, or Git Bash on Windows.
- Generate a new ED25519 SSH key pair with your
ssh-keygen -t ed25519 -C "YOUR_CSE_NETID@cs.uw.edu"
- Next, you will be prompted to input a file path for your SSH key pair. Accept the defaults by pressing Enter on your keyboard.
- 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.
- Copy your public SSH key (filename ending in
pub) to the clipboard by using one of the commands below depending on your Operating System:
pbcopy < ~/.ssh/id_ed25519.pub
- Linux (requires the
xclip -sel clip < ~/.ssh/id_ed25519.pub
- Git Bash on Windows:
cat ~/.ssh/id_ed25519.pub | clip
- Visit your CSE GitLab account at gitlab.cs.washington.edu.
- 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 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. Then, open IntelliJ. 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.
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.
Once IntelliJ has finished restarting, we’ll need to setup the Checkstyle plugin with course-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.
- Change the Scan Scope dropdown in the top right to Only Java sources (including tests).
Add the checkstyle configuration. Tap the + icon on the right side under Configuration File section. In the window that appears, enter a description like “CSE 332 Checks”. Then, select Use a Checkstyle file accessible via HTTP and paste the following address.
- Back in the Checkstyle settings, mark the checkbox next to “CSE 332 Checks” to enable it. Finally, tap OK to apply the updated settings.
Now that the initial IntelliJ setup is done, we can download a copy of the homework by cloning your personal CSE GitLab repository. Unlike other courses, you’ll be using a single repository all quarter long.
First, let’s make sure that you have access to your personal repository. Visit the CSE 332 Winter 2020 Students group, login with your CSE NetID, and you’ll be greeted by four repositories:
skeleton, and a repository named after your CSE 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,
Tap the blue Clone button and copy the Clone with SSH Git address. This should look like the following address except named after your CSE NetID.
In the IntelliJ welcome window, tap on 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.
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 if/when prompted.
After importing 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 future homework assignments at the touch of a button.
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.
Setup is done! Next, follow the Using IntelliJ quick start guide to introduce yourself to the software we’ve just installed.