Utils

GitHub SSH Key Setup & Working With Your Repo

Generating SSH keys, cloning repos, and pushing with IntelliJ

Prerequisites

Tool Purpose
IntelliJ IDEA IDE for Java projects (Community edition is free)
Git for Windows Includes Git Bash, a Unix-like shell for Git commands

Git Bash is the recommended command line for working with Git on Windows. It ports Bash to Windows because Git is deeply tied into Unix tools.


Generating an SSH key

SSH keys let Git identify you to GitHub without passwords. Open Git Bash and run:

ssh-keygen
  • Accept the default file location (~/.ssh/id_...)
  • Leave the passphrase blank (otherwise you’ll be prompted every time you interact with GitHub)

This generates a key pair: a private key and a public key (.pub extension).


Adding the key to GitHub

Print the public key:

cat ~/.ssh/id_ed25519.pub

Copy the output, then in GitHub:

  1. Click your profile icon -> Settings
  2. Go to SSH and GPG keys
  3. Click New SSH key
  4. Give it a descriptive title (e.g. the machine name)
  5. Paste the public key and click Add SSH key

Cloning a repository

From the repository page on GitHub, click Code and select the SSH tab to get the SSH URL.

cd ~/Desktop
git clone git@github.com:org/repo-name.git

The first time connecting to GitHub, you’ll be asked to confirm the host - type yes.

Avoid storing code on OneDrive or similar cloud sync services. They add overhead and can cause issues with Git.


Opening the project in IntelliJ

  1. Open IntelliJ and select Open
  2. Navigate to the cloned repository
  3. Select the pom.xml file and choose Open as Project
  4. Trust the project when prompted

Maven will automatically download all project dependencies and configure external libraries.

If no JDK is installed, IntelliJ can download one: File -> Project Structure -> SDK -> Download JDK (e.g. Microsoft OpenJDK, language level 21).


Running tests

Right-click on any test file or directory in IntelliJ and select Run. Tests will show pass/fail status directly in the IDE.


Committing and pushing changes

IntelliJ has a built-in commit UI:

  1. Open the Commit tab (second icon in the left panel)
  2. Review changed files - select a file and press Ctrl+D to see the diff
  3. Check the files to include
  4. Write a commit message
  5. Click Commit and Push to send changes to GitHub in one step

On first push, IntelliJ may ask for a Git email - this is associated with your commits.


The full cycle

  1. Set up SSH key and add it to GitHub
  2. Clone the repository using the SSH URL
  3. Open the project in IntelliJ via the pom.xml
  4. Edit code and run tests locally
  5. Commit and push using IntelliJ’s built-in UI
  6. The autograder runs automatically on GitHub Actions
  7. Check results in the repository’s Actions tab