Skip to content
Discussion options

You must be logged in to vote

You're encountering a common point of confusion for GitHub Copilot in the CLI!

The gh copilot extension specifically requires authentication via the GitHub CLI OAuth app, not just a Personal Access Token (PAT) from the GH_TOKEN environment variable.

Even if gh CLI itself is working with your PAT for other commands, the Copilot extension has a stricter requirement for its own authentication.


To fix this:

Temporarily clear your GH_TOKEN environment variable:

  • On Linux/macOS:

    unset GH_TOKEN
  • On Windows (Command Prompt):

    set GH_TOKEN=
  • On Windows (PowerShell):

    Remove-Item Env:GH_TOKEN

Run the recommended authentication command:

gh auth login --web -h github.com

This will open your web …

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@johnwildes
Comment options

@theophanemayaud
Comment options

@yuliia-sukhova
Comment options

@theophanemayaud
Comment options

Answer selected by johnwildes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Ask and answer questions about GitHub features and usage Copilot in GitHub Copilot functionality in GitHub Copilot Chat and in github.com
4 participants