About GitHub Classroom CLI
GitHub CLI is an open source tool for using GitHub from your computer's command line. When you're working from the command line, you can use the GitHub CLI to save time and avoid switching context. For more information, see "About GitHub CLI."
You can work with GitHub Classroom in the GitHub CLI to:
- List classrooms
- View classroom information
- List assignments
- List accepted assignments
- View assignment information
- Clone an assignment's starter code repository
- Clone a student’s assignment repository
Setting up GitHub CLI
For installation instructions for GitHub CLI, see the GitHub CLI repository.
Using the GitHub Classroom extension with GitHub CLI
If you have not already done so, run gh auth login
to authenticate with your GitHub account.
To install the GitHub Classroom extension, run gh extension install github/gh-classroom
.
To use gh
to work with GitHub Classroom, type gh classroom SUBCOMMAND
.
As an example of a series of commands you might use to work with GitHub Classroom, you could:
- List your classrooms:
gh classroom list
- List the assignments for a specific classroom:
gh classroom assignments
- View information for a specific assignment:
gh classroom assignment
gh
subcommands for GitHub Classroom
These sections give example subcommands for each of the available operations. When applicable, the CLI will prompt you to choose a classroom after you run the subcommand.
On the command line, use gh classroom --help
for general help or gh classroom SUBCOMMAND --help
for help with a specific subcommand.
List classrooms
gh classroom list
List of classrooms you own.
View classroom information
gh classroom view
Display the classroom ID, classroom slug, title, and other information about a classroom.
List assignments
gh classroom assignments
Display a list of assignments for a classroom.
List accepted assignments
gh classroom accepted-assignments
Display a list of accepted assignments and information about the student's assignments.
View assignment information
gh classroom assignment
Displays assignment information.
Clone an assignment's starter code repository
gh classroom clone starter-repo
Clones starter code repo used by an assignment. By default, the starter code is cloned into the current directory. To clone into a different directory, use the --directory
flag. If the directory does not exists, it will be created.
Clone a student’s assignment repository
gh classroom clone student-repos
Clones student repositories from a given assignment. By default, the student repositories are cloned into the current directory a directory named after the assignment slug. To clone into a different directory, use the --directory
flag. If the directory does not exists, it will be created.
By default, all student repositories are cloned. To get a different number of repositories, use the --per-page NUMBER
flag.