Using GitHub Copilot in the command line - GitHub Docs
Skip to main content

Using GitHub Copilot in the command line

You can use Copilot with the GitHub CLI to get suggestions and explanations for the command line.

Prerequisites

If you have access to GitHub Copilot via your organization or enterprise, you cannot use Copilot in the CLI if your organization owner or enterprise administrator has disabled Copilot in the CLI. See Managing policies for Copilot in your organization.

Getting command explanations

To ask Copilot in the CLI to explain a command, run gh copilot explain followed by the command that you want explained. For example:

Shell
gh copilot explain "sudo apt-get"

Getting command suggestions

To ask Copilot in the CLI to suggest a command, run gh copilot suggest followed by the command that you want. For example:

Shell
gh copilot suggest "Undo the last commit"

Copilot in the CLI will start an interactive session to get more information about what you want.

If you choose the Execute command option after Copilot in the CLI suggests a command, Copilot in the CLI will copy the command to your clipboard and exit the interactive session. Then you can manually paste the command into your CLI.

If you want Copilot in the CLI to be able to execute commands on your behalf, you must set up the ghcs alias. See Configuring GitHub Copilot in the CLI.

Sharing feedback

To send feedback to GitHub about the quality of a suggestion, select the Rate response option in Copilot in the CLI.

You can also open an issue in the Copilot in the CLI extension repository.

Further reading

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.