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. Accept the assignment and open the Codespace
- 2. Write and check your code
- 3. Submit, and read the feedback
1. Accept the assignment and open the Codespace
- On the lesson, select Accept the assignment on GitHub, then press the green Accept this assignment button.
- 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.
- 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”.
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
- Open the file named on the lesson, inside the
srcfolder. It is the only file you need to change. - Complete each
TODOin order. The comment above each task shows the output it should print. - Check your work in either of two ways:
- Run it: press Run (above
mainin 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.shand press Enter. A green tick means a test passed. A red cross shows what the test expected, which tells you what to fix.
- Run it: press Run (above
3. Submit, and read the feedback
- Select the Source Control icon (the branch shape) in the left-hand bar.
- Type a short message such as
completed tasks, then press Commit. If asked whether to stage all changes, choose Always. - Press Sync Changes. If asked about pushing and pulling, choose OK, Don’t Show Again.
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
- Open your repository on GitHub and select the Pull requests tab.
- Open the pull request called Feedback, then the Files changed tab. Your teacher’s comments sit beside the lines they are about.
- Fix your code in the Codespace, run
bash run-tests.shto check, then commit and sync again (section 3). The autograder runs again.