Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh does not respect GITHUB_TOKEN? #2771

@kljensen

Description

@kljensen

Describe the bug

The gh binary does not appear to respect the GITHUB_TOKEN environment variable, where that token stores a "personal access token"

Steps to reproduce the behavior

Type

/ # GITHUB_TOKEN=MY_TOKEN_WAS_HERE gh auth status
github.com
  ✓ Logged in to github.com as kljensen (GITHUB_TOKEN)
  ✓ Git operations for github.com configured to use https protocol.
  ✓ Token: *******************

This shows me that I am good-to-go, I believe. But, then, when I try to clone a repo, I get the following prompt for a username:

/ # GITHUB_TOKEN=MY_TOKEN_WAS_HERE gh repo clone 'kljensen/dotfiles'
Cloning into 'dotfiles'...
Username for 'https://github.com':

The repo "kljensen/dotfiles" is private.

Expected vs actual behavior

I expected to be able to clone the repo because I had a valid GITHUB_TOKEN environment variable. Instead, I was prompted to authenticate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions