Working in GitHub Codespaces

The GitHub Classroom assignments on the programming lessons open in a Codespace: a code editor in your browser with everything already set up. This guide goes from accepting an assignment to reading your teacher’s feedback. The same steps work for every assignment. Only the file name changes.

  1. 1. Accept the assignment and open the Codespace
    1. In Java: choose Standard mode
  2. 2. Write and check your code
  3. 3. Submit, and read the feedback
    1. Reading your teacher’s feedback

1. Accept the assignment and open the Codespace

  1. On the lesson, select Accept the assignment on GitHub, then press the green Accept this assignment button.
  2. Open the link in the email GitHub sends to the address on your account. It goes straight to your own copy of the assignment, so nobody has to share a link with you.
  3. When your repository is ready, press Open in Codespace and wait for the editor to load in your browser.

Two notices appear the first time. Neither is part of the assignment:

  • “Would you like VS Code to periodically run git fetch?” Press No.
  • “There’s a pull request associated with main.” Press Don’t Show Again.

In Java: choose Standard mode

Look at the status bar along the bottom of the editor. If it says Java: Lightweight Mode, select it and choose Standard, then wait until it says Java: Ready. In Lightweight mode the Run button does not appear and Java reports “Main method not found”.

The status bar in Java Lightweight mode The bottom bar of the editor shows the branch name main and the words Java: Lightweight Mode. Selecting those words opens a choice between Lightweight and Standard. main Java: Lightweight Mode Lightweight Standard
Select Java: Lightweight Mode in the status bar, then choose Standard.

In Python there is no mode to change: the Run button sits at the top right of the editor.


2. Write and check your code

  1. Open the file named on the lesson, inside the src folder. It is the only file you need to change.
  2. Complete each TODO in order. The comment above each task shows the output it should print.
  3. Check your work in either of two ways:
    • Run it: press Run (above main in Java, at the top right in Python) and compare what it prints with the expected output.
    • Run the tests: open Terminal > New Terminal, type bash run-tests.sh and press Enter. A green tick means a test passed. A red cross shows what the test expected, which tells you what to fix.

3. Submit, and read the feedback

  1. Select the Source Control icon (the branch shape) in the left-hand bar.
  2. Type a short message such as completed tasks, then press Commit. If asked whether to stage all changes, choose Always.
  3. Press Sync Changes. If asked about pushing and pulling, choose OK, Don’t Show Again.
Committing and syncing in Source Control The Source Control panel has a message box containing completed tasks, a Commit button below it, and after committing a Sync Changes button. SOURCE CONTROL completed tasks Commit then Sync Changes The autograder runs, and your teacher sees the result.
Write a message, press Commit, then Sync Changes.

The autograder (GitHub’s automatic tests) runs on its own, and your teacher sees the result in the GitHub Classroom dashboard.

Reading your teacher’s feedback

  1. Open your repository on GitHub and select the Pull requests tab.
  2. Open the pull request called Feedback, then the Files changed tab. Your teacher’s comments sit beside the lines they are about.
  3. Fix your code in the Codespace, run bash run-tests.sh to check, then commit and sync again (section 3). The autograder runs again.