1
0
mirror of synced 2025-12-19 18:10:59 -05:00
Files
docs/content/copilot/github-copilot-in-the-cli/using-github-copilot-in-the-cli.md
Sophie 60b71c4e24 [DO NOT MERGE] November 8–9: GitHub Universe 2023 megabranch (#44245)
Co-authored-by: mchammer01 <42146119+mchammer01@users.noreply.github.com>
Co-authored-by: Courtney Claessens <courtneycl@github.com>
Co-authored-by: Anne-Marie <102995847+am-stead@users.noreply.github.com>
Co-authored-by: Steve Guntrip <stevecat@github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jules <19994093+jules-p@users.noreply.github.com>
Co-authored-by: Jules Porter <jules-p@users.noreply.github.com>
Co-authored-by: Sarita Iyer <66540150+saritai@users.noreply.github.com>
Co-authored-by: hubwriter <hubwriter@github.com>
Co-authored-by: Melissa Xie <mxie@users.noreply.github.com>
Co-authored-by: Andy Feller <andyfeller@github.com>
Co-authored-by: Felicity Chapman <felicitymay@github.com>
Co-authored-by: Kelly Arwine <kellyarwine@github.com>
Co-authored-by: Ben Ahmady <32935794+subatoi@users.noreply.github.com>
Co-authored-by: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
Co-authored-by: Tiferet Gazit <tiferet@github.com>
Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
Co-authored-by: Isaac Brown <101839405+isaacmbrown@users.noreply.github.com>
Co-authored-by: Annelisa Stephan <meowius@github.com>
Co-authored-by: Vanessa <vgrl@github.com>
Co-authored-by: Rachael Rose Renk <91027132+rachaelrenk@users.noreply.github.com>
Co-authored-by: Matt Pollard <mattpollard@users.noreply.github.com>
Co-authored-by: isaacmbrown <isaacmbrown@github.com>
Co-authored-by: Greg Padak <gpadak@github.com>
2023-11-08 17:35:45 +01:00

4.5 KiB
Raw Blame History

title, intro, product, versions, topics, shortTitle
title intro product versions topics shortTitle
Using GitHub Copilot in the CLI You can use `gh`, the {% data variables.product.prodname_dotcom %} command line interface, to work with {% data variables.product.prodname_copilot_cli %}. {% data reusables.gated-features.copilot-in-cli %}
feature
copilot-in-the-cli
Copilot
CLI
Using Copilot in the CLI

About using {% data variables.product.prodname_copilot_cli %}

{% data reusables.cli.about-cli %} For more information, see "AUTOTITLE."

{% data variables.product.prodname_copilot_cli %} is an extension for {% data variables.product.prodname_cli %} which provides a chat-like interface in the terminal that allows you to ask questions about the command line. You can ask {% data variables.product.prodname_copilot_cli_short %} to suggest a command for your use case, with gh copilot suggest, or to explain a command you're curious about, with gh copilot explain.

Prerequisites

  • To use {% data variables.product.prodname_copilot_cli_short %} you must have an active {% data variables.product.prodname_copilot %} subscription. For more information, see "AUTOTITLE."
  • To use {% data variables.product.prodname_copilot_cli_short %} you must have {% data variables.product.prodname_cli %} installed. {% data reusables.cli.cli-installation %}

Installing {% data variables.product.prodname_copilot_cli_short %}

If you have not already done so, run gh auth login to authenticate with your {% data variables.product.prodname_dotcom %} account.

To install the {% data variables.product.prodname_copilot_cli_short %} extension, run gh extension install github/gh-copilot.

To update {% data variables.product.prodname_copilot_cli_short %}, run gh extension upgrade gh-copilot.

Using {% data variables.product.prodname_copilot_cli_short %}

To use gh to work with {% data variables.product.prodname_copilot %}, type gh copilot SUBCOMMAND. Additionally, you can use gh copilot --help for general help or gh copilot SUBCOMMAND --help for help with a specific subcommand.

Asking {% data variables.product.prodname_copilot_cli_short %} to explain a command

You can ask {% data variables.product.prodname_copilot_cli_short %} to explain a command for you by running:

gh copilot explain

Alternatively, you can add the command you want explained directly to the prompt:

gh copilot explain "sudo apt-get"

{% data variables.product.prodname_copilot_cli_short %} can help by explaining what a command does in plain language. This makes it easier for you to understand the command's purpose and how it works for a specific example. You don't need to go through the command's documentation because the explanation includes information about what the command takes as input and produces as output, and provides practical examples.

Asking {% data variables.product.prodname_copilot_cli_short %} to suggest a command

You can ask {% data variables.product.prodname_copilot_cli_short %} to suggest a command for you by running:

gh copilot suggest

This will start an interactive experience to get the command you need. {% data variables.product.prodname_copilot_cli_short %} aims to suggest commands that help you perform the tasks youre trying to complete. To help {% data variables.product.prodname_copilot_cli_short %} provide better suggestions, you can specify the type of command you are looking for (generic, git or gh).

If you already know what command you need, you can also include that in the prompt. For example, if you want to install Git, you can ask {% data variables.product.prodname_copilot_cli_short %} to suggest a command for you:

gh copilot suggest "Install git"

If the result isnt quite what youre looking for, you can keep revising your question until the returned command meets your expectations. You can do this by selecting the Revise command option.

Once youve generated the perfect command for your task, you can easily copy it to your clipboard to run it wherever you need by selecting the Copy to clipboard option.

Sharing feedback about {% data variables.product.prodname_copilot_cli_short %}

If you encounter any issues or limitations with {% data variables.product.prodname_copilot_cli_short %}, you can provide feedback by selecting the Rate response option in {% data variables.product.prodname_copilot_cli_short %}.