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:
For installation instructions for GitHub CLI, see the
GitHub CLI repository
.
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
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.
gh classroom list
List of classrooms you own.
gh classroom view
Display the classroom ID, classroom slug, title, and other information about a classroom.
gh classroom assignments
Display a list of assignments for a classroom.
gh classroom accepted-assignments
Display a list of accepted assignments and information about the student's assignments.
gh classroom assignment
Displays assignment information.
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.
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.