Copilot CLI doesn't work with GH_TOKEN authentication?
#167158
Select Topic AreaQuestion Copilot Feature AreaGeneral BodyHello,
When I attempt
So which is it? I want to use the token environment variable for authentication and |
Replies: 1 comment 4 replies
|
You're encountering a common point of confusion for GitHub Copilot in the CLI! The Even if To fix this:Temporarily clear your
Run the recommended authentication command: gh auth login --web -h github.comThis will open your web browser to complete the OAuth authentication process, which is what the Copilot extension needs. Once authenticated via the web browser, |
You're encountering a common point of confusion for GitHub Copilot in the CLI!
The
gh copilotextension specifically requires authentication via the GitHub CLI OAuth app, not just a Personal Access Token (PAT) from theGH_TOKENenvironment variable.Even if
ghCLI 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_TOKENenvironment variable:On Linux/macOS:
unset GH_TOKENOn Windows (Command Prompt):
On Windows (PowerShell):
Remove-Item Env:GH_TOKENRun the recommended authentication command:
This will open your web …