git/list[1] front-page[2] threads[3] people[4] search[5] about
 

UX failure: SSH authentication failure diagnostics

From
RJRyan Johnson <ryan.johnson.code@gmail.com>
Date
Dec 9, 2025, 05:08 UTC
Message-ID
<DS0PR03MB729012244C8A65D318FDC205A3A3A@DS0PR03MB7290.namprd03.prod.outlook.com>

When Git fails SSH authentication, the error message provides no indication that Git may be using a different SSH client than the user expects.

PROBLEM
Multiple SSH implementations commonly coexist on a single system:
  Windows:
    - Windows OpenSSH: C:\Windows\System32\OpenSSH\ssh.exe
    - Git's bundled SSH: C:\Program Files\Git\usr\bin\ssh.exe
  macOS:
    - System SSH: /usr/bin/ssh
    - Homebrew SSH: /opt/homebrew/bin/ssh
  Linux:
    - System SSH: /usr/bin/ssh
    - Snap/Flatpak-packaged Git may bundle its own SSH
    - Alternative installations: /usr/local/bin/ssh

These may use separate key stores and agents. On Windows, the system ssh-agent service is inaccessible to Git's bundled MSYS2 SSH.

A user who runs:
  ssh -T git@github.com    # Works - uses one SSH binary
  git push                 # Fails - uses different SSH binary
receives only:
  git@github.com: Permission denied (publickey).
  fatal: Could not read from remote repository.

This error gives no indication that Git is using a different SSH binary than the one the user just tested. The user has no reason to suspect this is the cause. Debugging this issue typically costs hours of research.

SOLUTION
When SSH authentication fails, Git should:
1. Print which SSH command it invoked:
     Using SSH: /opt/homebrew/bin/ssh
2. Detect if multiple ssh binaries exist in PATH or common locations. If so:
     Note: Multiple SSH clients detected on this system.
     Git is using: C:\Program Files\Git\usr\bin\ssh.exe
     Also found:   C:\Windows\System32\OpenSSH\ssh.exe
     
     To use a different SSH client:
       git config --global core.sshCommand "/path/to/preferred/ssh"
This diagnostic should only appear on authentication failure, not on success.
RATIONALE

Git for Windows bundles MSYS2 tools for cross-platform consistency. Homebrew and Snap/Flatpak may install SSH binaries that shadow or conflict with system SSH. These are reasonable packaging decisions, but the resulting SSH client mismatch is a known, common failure mode that produces no actionable diagnostic information.

The fix is a one-line config change. The problem is that users have no way
to discover this without external research. Surfacing this information at
the point of failure would eliminate significant friction for beginners
as well as veterans. Seasoned programmers and beginners alike complain about
UX failures like this one all the time. Considering your tool has become de-facto
standard, you should take care of these problems. Dealing with this problem
 is the responsibility of the tooling creators, not the users. Do not shunt
responsibility onto every user to sit and spend an entire day of research and
headache unraveling your poorly-communicated configuration nuances.

-- Ryan

Next: D. Ben Knoble
Message 1 of 2 in “UX failure: SSH authentication failure diagnostics”
  1. Ryan JohnsonDec 9, 2025
  2. D. Ben KnobleDec 12, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.