Skip to content

gh auth login prompts for SSH key title but silently discards it when an existing key is reused #13647

@amm98d

Description

@amm98d

Describe the bug

When running gh auth login with SSH as the preferred protocol, the CLI asks:

What title would you like to use for the SSH key?

However, if an existing SSH key is already present locally (e.g. ~/.ssh/id_ed25519) and already registered on GitHub, the CLI silently reuses that key and never uploads a new one — meaning the title the user just typed is completely discarded with no feedback.

Steps to reproduce

  1. Have an existing ~/.ssh/id_ed25519 key already added to your GitHub account
  2. Run gh auth login
  3. Select GitHub.comSSH → authenticate via browser
  4. When prompted, enter a title for the SSH key
  5. Complete authentication

Expected behavior

Either:

  • Skip the SSH key title prompt entirely if an existing key will be reused, or
  • After completing auth, display a message like: "An existing SSH key was found and reused. The title you entered was not used."

Actual behavior

The title prompt is shown, the user enters a name, and it is silently discarded. No new key appears on GitHub. The user has no way of knowing their input had no effect.

Environment

gh version 2.x (darwin)

Metadata

Metadata

Assignees

No one assigned

    Labels

    gh-authrelating to the gh auth commandmore-info-neededMore info needed from user/contributorneeds-triageneeds to be reviewed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions