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.
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+.
First hour: install, sign in, land a reviewable change
- 1
Install from an official channel
All platforms via npm:
npm install -g @github/copilot(Node 22+). If~/.npmrchasignore-scripts=true, usenpm_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
Confirm the binary, then enter the repo
Open a new terminal. Run
copilot --versionorcopilot.command not foundis usually PATH; the script installs to$HOME/.local/binfor a non-root user. Do not fall back togh copilot. - 3
Authenticate with /login
cdinto a repo you own and runcopilot. If you are not signed in, enter/loginand 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 exportCOPILOT_GITHUB_TOKEN,GH_TOKEN, orGITHUB_TOKENin that order. An already-authenticatedghis the last fallback./userprints the account in session. - 4
Give a reviewable first task
GitHub’s getting-started note suggests
/initto 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 firstChannels, auth, pitfalls
| Path | What GitHub writes | First-hour note |
|---|---|---|
| npm @github/copilot | All platforms; Node 22+ | ignore-scripts blocks install |
| Install script | macOS/Linux; PREFIX / VERSION | New terminal before copilot |
| Homebrew cask | copilot-cli | Not the old gh extension |
| WinGet | GitHub.Copilot | PowerShell 6+ |
| Org policy off | Admin can disable CLI | Ask admin before blaming the plan |
Installed, still command not found
Usually PATH. Non-root script default is $HOME/.local/bin. New terminal. Confirm the package is @github/copilot.
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.
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_TOKEN→GH_TOKEN→GITHUB_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.