Skip to content

**Copilot CLI fails to authenticate with valid tokens** #355

@StiffDogson

Description

@StiffDogson

Describe the bug

Copilot CLI fails to authenticate with valid tokens

  • OS: 14.8.1 (23J30)
  • Shell: bash
  • Copilot CLI version: 0.0.339 Commit: 66f4dfe
  • Authentication method: classic PAT (repo, read:org, gist), fine-grained PAT
  • Token set as: GITHUB_TOKEN, GH_TOKEN
  • Error: "Error during sign-in: fetch failed"
  • /login command: "Error during sign-in: fetch failed"
  • gh auth login works for GitHub CLI, but Copilot CLI doesn't pick it up.
  • Steps tried:
  1. Verified internet connectivity to GitHub using curl https://api.github.com.
  2. Installed and updated Copilot CLI to the latest version (0.0.339, commit 66f4dfe).
  3. Generated both fine-grained and classic personal access tokens (PATs) with recommended permissions (repo, read:org, gist for classic; all available for fine-grained).
  4. Set tokens as environment variables (GH_TOKEN and GITHUB_TOKEN) in the terminal (export GH_TOKEN=..., export GITHUB_TOKEN=...).
  5. Verified environment variables are correctly set using echo $GH_TOKEN and echo $GITHUB_TOKEN.
  6. Ensured no conflicting proxy or authentication-related environment variables were set.
  7. Ran Copilot CLI commands such as copilot -p "List my open PRs" --allow-all-tools and received "No authentication information found" error.
  8. Attempted to use Copilot CLI /login command (received "Invalid command format" error).
  9. Tried logging in via GitHub CLI (gh auth login) and confirmed authentication, but Copilot CLI still failed to recognize authentication.
  10. Tried both classic and fine-grained tokens individually in new terminal sessions, including direct export in session and via ~/.zshrc.
  11. Tested on different shells (confirmed current shell with echo $SHELL), and opened new terminal windows.
  12. Checked for Copilot CLI known issues and similar bug reports on GitHub.
  13. Verified Copilot Pro trial status and Copilot feature enablement in GitHub account settings.
  14. Enabled Copilot extension in macOS System Settings.
  15. Restarted Xcode, Copilot plugin, and terminal after each configuration change.

Expected: Copilot CLI should authenticate and run commands.
Actual: Authentication fails with all methods.

Please advise or confirm any breaking changes/known issues.

Affected version

0.0.339 Commit: 66f4dfe

Steps to reproduce the behavior

  1. Install GitHub Copilot CLI (version 0.0.339).
  2. Generate a classic or fine-grained personal access token (PAT) on GitHub with the recommended permissions (repo, read:org, gist for classic, or all available for fine-grained).
  3. Export the token as an environment variable in your terminal session:
    • For classic: export GITHUB_TOKEN=your_pat_here
    • For fine-grained: export GITHUB_TOKEN=your_fg_pat_here
  4. Open a new terminal window to ensure the environment variable is loaded.
  5. Verify the token is set by running: echo $GITHUB_TOKEN
  6. Run the following Copilot CLI command:
    copilot -p "List my open PRs" --allow-all-tools
  7. Observe the error:
    Error: No authentication information found.

Expected behavior

To be able to login successfully

Additional context

Shell : Bash
On Mac OS X Sonoma 14.8.1
Chip: Apple M2
XCode 15.2

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions