Symptom

When SSHing into my Windows 11 laptop — via Windows’ built-in OpenSSH (sshd) from Termux on Android — and running git push/pull operations (including through lazygit), the operation fails immediately with:

fatal: Unable to persist credentials with the 'wincredman' credential store.

The same operations work fine in a local Windows terminal tab. The error is strictly SSH-session-specific.

Root Cause

wincredman (Windows Credential Manager) is the default credential store for Git Credential Manager on Windows. It explicitly does not support SSH or network sessions — it requires an interactive Windows desktop session to access the credential vault.

This is confirmed in the GCM credential stores documentation, which notes that Windows Credential Manager is inaccessible over remote/SSH sessions.

Since the SSH session from Termux has no access to the Windows desktop session context, GCM can’t read or write credentials — hence the fatal error.

Diagnostic

The key tell is that the failure is session-type-dependent:

  • Local Windows terminal → git works fine
  • SSH session into the same machine → git fails with the wincredman error

If that asymmetry is present, this is almost certainly the cause.

Fix

Switch GCM’s credential store to dpapi (DPAPI-protected files), which works across all session types including SSH:

git config --global credential.credentialStore dpapi

DPAPI (Windows Data Protection API) encrypts credential files on disk tied to your Windows user account, rather than routing through the interactive Credential Manager UI. It works in SSH sessions because it only needs your user identity, not a live desktop session.

Source

Found via a comment in the GCM GitHub Discussions thread:

wincredman error over SSH via VSCode remote with GitHub CLI · Discussion #1346

Confirmed by the official GCM credential stores documentation.