-
Notifications
You must be signed in to change notification settings - Fork 20
gh student
Every command and flag for the student CLI. For a walkthrough, see the CLI Student Guide.
Run gh student <command> --help for the live flag list. Errors go to stderr
with a non-zero exit code. Pass --verbose / -v for per-step detail.
| Command | Description |
|---|---|
whoami |
Print the authenticated GitHub user. |
login |
Log in with the unified Classroom 50 scopes (admin:org, read:org, repo, workflow) — the same set gh teacher login requests, so one sign-in covers both. A student only exercises read:org, repo, and workflow. |
logout |
Log out via gh auth logout. |
accept <org> <classroom> <assignment> |
Accept an assignment: auto-accept the org invite, create your private repo, and set up autograding. |
invite <org>/<repo> <username> |
Invite a classmate or TA to your repo with push permission. |
submit |
Snapshot the current branch and push it for grading. |
gh student accept <org> <classroom> <assignment>Creates a private repo at <org>/<classroom>-<assignment>-<username> (a copy of
the assignment's template, or an empty repo if it's template-less), then prints
a git clone command.
What accept does, step by step
- Auto-accepts any pending org invitation.
- Looks up the assignment in the classroom's published
assignments.jsonon Pages. Atemplateblock resolves the starter; its absence means a template-less empty repo. - Resolves the autograder workflow shim. The
defaultautograder uses the shim embedded ingh-student; a non-default one is fetched from Pages (resolved before creating the repo, so a fetch failure leaves no half-baked repo). - Creates the repo — from the template, an empty
auto_initrepo, or (for anempty_repoassignment) a truly bare repo with steps 3 and 7 skipped. - Disables issues, projects, and wiki.
- Sets your repo role:
pushfor an individual assignment, oradminfor a group assignment (so a group founder can invite teammates). - Commits
.classroom50.yamland.github/workflows/autograde.yamlin one commit. The metadata records the classroom, assignment, and (when present) the template repo.gh student submitre-fetches.gitignoreand.github/from that template. - Prints the
git clonecommand.
Already accepted? The command reports Assignment already accepted: <org>/<repo>
and leaves your repo alone.
Common errors:
| Message | What it means |
|---|---|
"the classroom may not exist yet, or publish-pages.yaml may not have run" |
Setup isn't finished or Pages hasn't deployed. Wait, or ask your teacher. |
| "assignment X is not registered" | A typo, or your teacher hasn't added the assignment. |
"autograder <name> not published yet" / "is malformed YAML" |
The autograder's YAML is missing or broken. Ask your teacher. |
"template <owner>/<repo> is not accessible to you" |
The template is private and not shared with you. Ask your teacher to make it public or grant access. |
"assignment <X> has unsupported mode <mode>" |
The manifest's mode is neither individual nor group (likely hand-edited). Ask your teacher. |
gh student invite <org>/<repo> <username>Adds a classmate or TA to your repo with push permission. For a group
assignment, the founder uses this to add each teammate.
Run from inside a cloned assignment repo:
gh student submitSnapshots your submittable files (tracked, plus untracked files that aren't
ignored) and pushes them as a new commit on the repo's
default branch. The autograde workflow then tags the commit
submit/<UTC-timestamp>-<short-sha>, grades it, and publishes a scored Release a
minute or two later.
Functionally equivalent to git commit -am "Submit" && git push, with one extra
step: it refreshes the teacher's .gitignore and .github/ from the template
(skipped for a template-less assignment).
What submit does, step by step
- Reads
.classroom50.yamlfor the template coordinates and identity. - Copies submittable files (tracked + untracked-not-ignored) into a temp worktree, so build artifacts don't pollute the submission.
- Fetches the teacher's
.gitignoreand.github/from the template. - Commits (with your GitHub login + noreply email) and pushes to the default branch as a fast-forward — no force-push; prior commits stay reachable.
- Prints the Actions and Releases URLs.
Tagging is the runner's job. The acceptance commit is skipped (nothing to
grade); your first real submit always grades. GIT_AUTHOR_* / GIT_COMMITTER_*
override the default identity.
Note
Feedback PR timing. If your teacher enabled feedback, one long-lived
Feedback pull request is opened when you accept, and the same PR is reused for
every later submission. If it couldn't be opened then, run accept again to
retry (or it appears on your first submission when autograding is enabled).
-
whoami— prints the authenticated GitHub user. -
login— runsgh auth login -s admin:org -s read:org -s repo -s workflow(the unified scope set, shared withgh teacher login); add scopes with-s. -
logout— runsgh auth logout.
Building, testing, and linting the extension are documented in the
cli/gh-student/ README.