Skip to content

login working, but "GitHub.com: authentication failed" #6979

@nick-youngblut

Description

@nick-youngblut

Describe the bug

I can login successfully via gh auth login -h GitHub.com -p https, but then gh auth status shows:

GitHub.com
  X GitHub.com: authentication failed
  - The GitHub.com token in /home/gitpod/.config/gh/hosts.yml is no longer valid.
  - To re-authenticate, run: gh auth login -h GitHub.com
  - To forget about this host, run: gh auth logout -h GitHub.com

Steps to reproduce the behavior

gh auth login -h GitHub.com -p https
? Authenticate Git with your GitHub credentials? Yes
? How would you like to authenticate GitHub CLI? Login with a web browser

! First copy your one-time code: XXXX-XXXX
Press Enter to open GitHub.com in your browser... 
# successfully log in via the browser

gh auth status  # will show authentication failed

devcontainer

I'm connecting to a remote machine via ssh in VS Code. I'm using the following devcontainer in VS Code:

{
    "name": "nfcore",
    "image": "nfcore/gitpod:2.7.1",
    "postCreateCommand": "bash .devcontainer/setup.sh",
    "remoteUser": "gitpod",
    // Configure tool-specific properties.
    "customizations": {
        // Configure properties specific to VS Code.
        "vscode": {
            // Set *default* container specific settings.json values on container create.
            "settings": {
                "python.defaultInterpreterPath": "/opt/conda/bin/python",
                "python.linting.enabled": true,
                "python.linting.pylintEnabled": true,
                "python.formatting.autopep8Path": "/opt/conda/bin/autopep8",
                "python.formatting.yapfPath": "/opt/conda/bin/yapf",
                "python.linting.flake8Path": "/opt/conda/bin/flake8",
                "python.linting.pycodestylePath": "/opt/conda/bin/pycodestyle",
                "python.linting.pydocstylePath": "/opt/conda/bin/pydocstyle",
                "python.linting.pylintPath": "/opt/conda/bin/pylint"
            },

            // Add the IDs of extensions you want installed when the container is created.
            "extensions": ["ms-python.python", "ms-python.vscode-pylance", "REditorSupport.r", "EditorConfig.EditorConfig",
                           "codezombiech.gitignore", "Gruntfuggly.todo-tree", "ms-vsliveshare.vsliveshare",
                           "nextflow.nextflow", "redhat.vscode-yaml", "streetsidesoftware.code-spell-checker"]
        }
	},
	"features": {
		"ghcr.io/devcontainers/features/docker-in-docker:2": {
            "version": "latest"
        },
        "ghcr.io/devcontainers/features/aws-cli:1": {
            "version": "latest"
        }
    }
}

gh install

curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \
  sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && \
  echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \
  sudo apt update && sudo apt install gh -y

gh version

gh version 2.22.1 (2023-01-27)
https://github.com/cli/cli/releases/tag/v2.22.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedContributions welcomepriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions