How to install and use GitHub Copilot CLI: auth and first repo task

Official install, /login, then one reviewable diff in your own repo. An active Copilot plan is required.

The first hour with GitHub Copilot CLI usually breaks on the installer, the login path, or a first task with no reviewable diff. Install the standalone copilot command, sign in with GitHub, then change one reversible line in a repo you own.

The query is how to install and use GitHub Copilot CLI. This page follows GitHub’s install and auth docs at docs.github.com/en/copilot/how-tos/copilot-cli. It is the standalone agent (the binary is copilot), not the deprecated gh copilot extension. To walk a diff on a short call, open a room on wbmeet; see how to create and join a room.

InstallSign inOne repo task

Check that you can run it at all

Official prerequisites: an active GitHub Copilot subscription. On Windows, PowerShell v6 or later. If Copilot comes from an organization or enterprise, an admin can disable Copilot CLI in policy. The npm path also needs Node.js 22+.

22+
Node for the npm path
PS 6
Windows minimum
1×
/login device flow

First hour: install, sign in, land a reviewable change

  1. 1

    Install from an official channel

    All platforms via npm: npm install -g @github/copilot (Node 22+). If ~/.npmrc has ignore-scripts=true, use npm_config_ignore_scripts=false npm install -g @github/copilot. macOS/Linux script: curl -fsSL https://gh.io/copilot-install | bash. Homebrew: brew install --cask copilot-cli. Windows WinGet: winget install GitHub.Copilot.

  2. 2

    Confirm the binary, then enter the repo

    Open a new terminal. Run copilot --version or copilot. command not found is usually PATH; the script installs to $HOME/.local/bin for a non-root user. Do not fall back to gh copilot.

  3. 3

    Authenticate with /login

    cd into a repo you own and run copilot. If you are not signed in, enter /login and finish the browser device flow. For automation, create a user-owned fine-grained PAT with the Copilot Requests account permission (do not pick an organization as owner), then export COPILOT_GITHUB_TOKEN, GH_TOKEN, or GITHUB_TOKEN in that order. An already-authenticated gh is the last fallback. /user prints the account in session.

  4. 4

    Give a reviewable first task

    GitHub’s getting-started note suggests /init to write Copilot instructions for this repo. Ask what the project does and where the entry point is, then: “Add a unit test for one untested helper, or input checks on one public function. Show the diff and wait.” Do not paste secrets into the prompt.

# Official install · as of 2026-09
npm install -g @github/copilot
copilot --version
cd /path/to/your/project
copilot
# /login   then /init
# first task: add a unit test for one helper; show the diff first

Channels, auth, pitfalls

PathWhat GitHub writesFirst-hour note
npm @github/copilotAll platforms; Node 22+ignore-scripts blocks install
Install scriptmacOS/Linux; PREFIX / VERSIONNew terminal before copilot
Homebrew caskcopilot-cliNot the old gh extension
WinGetGitHub.CopilotPowerShell 6+
Org policy offAdmin can disable CLIAsk admin before blaming the plan
01

Installed, still command not found

Usually PATH. Non-root script default is $HOME/.local/bin. New terminal. Confirm the package is @github/copilot.

02

Login loop or 403

Use /login. If the org disabled Copilot CLI, a personal seat will not help. PATs must be user-owned with Copilot Requests.

03

First task stayed a chat

/init is warmup. Finish with a reviewable change and read the diff.

Official Installing and Authenticating pages: install the standalone CLI, then /login or a token. Commands and org policy live on docs.github.com.

Standalone CLI ≠ gh copilot extension
The old GitHub CLI extension is deprecated. This page only covers copilot.
Token precedence
COPILOT_GITHUB_TOKENGH_TOKENGITHUB_TOKEN → keychain OAuth → gh auth token.
This is not a meeting-product guide
Only the first hour of Copilot CLI. Short whiteboard call: wbmeet or when not to open another heavy meeting app.

Questions worth checking

Can I use the CLI without a Copilot plan?

The install page lists an active Copilot subscription as a prerequisite. If an organization disables Copilot CLI, a personal seat is not enough.

npm, Homebrew, or the install script?

They all land the same copilot command. Use npm if you already have Node 22+. On macOS/Linux, the gh.io script or brew install --cask copilot-cli also work. On Windows use WinGet and PowerShell 6+.

How do I authenticate in CI?

Skip interactive /login. Use a fine-grained PAT with Copilot Requests and export COPILOT_GITHUB_TOKEN. Do not commit the token.

Must the first task touch production code?

No. Start with /init or a “what does this repo do” question, then one reversible change (test or validation) and read the diff first.

Start a free meeting