Skip to main content

Setting up GitHub Copilot in the CLI

Learn how to enable and install GitHub Copilot in the CLI.

If you have a GitHub Copilot Individual subscription, you can install the GitHub Copilot in the CLI extension without needing to enable it for your organization.

If you are part of an organization with a GitHub Copilot Business subscription, the organization owner will need to enable Copilot in the CLI in the Copilot settings. You can then install the GitHub Copilot in the CLI extension.

Enabling or disabling Copilot in the CLI at the organization level

An organization owner can enable or disable Copilot in the CLI for the organization.

  1. In the upper-right corner of GitHub, select your profile photo, then click Your organizations.
  2. Next to the organization, click Settings.
  3. In the "Code, planning, and automation" section of the sidebar, click Copilot, and then click Policies.
  4. To the right of "Copilot in the CLI", select the dropdown menu, then click Enabled or Disabled.

Installing Copilot in the CLI

To install Copilot in the CLI, you must have GitHub CLI installed. For installation instructions for GitHub CLI, see the GitHub CLI repository.

  1. If you have not already authenticated with your GitHub account, run the following command in your terminal.

    gh auth login
  2. To install the Copilot in the CLI extension, run the following command.

    gh extension install github/gh-copilot
  3. To update Copilot in the CLI, run the following command.

    gh extension upgrade gh-copilot

To use gh to work with GitHub Copilot, type gh copilot SUBCOMMAND, for example, gh copilot explain.

Next steps

You successfully installed Copilot in the CLI. To learn more about how to use it, see "Using GitHub Copilot in the CLI." If you want to configure usage analytics and the default behavior for the execute command option, see "Configuring GitHub Copilot in the CLI."