terminalcommand-line-interfacegithub-copilot

unknown command "copilot" for "gh"


Following the steps in https://learn.microsoft.com/en-us/training/modules/github-copilot-across-environments/4-git-hub-copilot-for-the-command-line

I run brew install gh then run gh copilot explain "sudo apt-get" , but I receive this error unknown command "copilot" for "gh".

Why does copilot not listed in the available commands in gh?

~ % gh copilot explain "sudo apt-get"                     
unknown command "copilot" for "gh"

Usage:  gh <command> <subcommand> [flags]

Available commands:
  alias
  api
  attestation
  auth
  browse
  cache
  co
  codespace
  completion
  config
  extension
  gist
  gpg-key
  issue
  label
  org
  pr
  preview
  project
  release
  repo
  ruleset
  run
  search
  secret
  ssh-key
  status
  variable
  workflow

Solution

  • I need to install the copilot extension by running gh extension install github/gh-copilot

    Ref: https://docs.github.com/en/copilot/how-tos/set-up/installing-github-copilot-in-the-cli