git-ecosystem/git-credential-manager · error · Exception

Can only use the ' ' credential store on Windows. See for…

Error message

Can only use the '{StoreNames.WindowsCredentialManager}' credential store on Windows.
See {Constants.HelpUrls.GcmCredentialStores} for more information.

What it means

ValidateWindowsCredentialManager enforces that the wincredman (Windows Credential Manager) store is only used on Windows, and that Windows Credential Manager persistence is available. When the configured store is wincredman but the OS is not Windows, GCM logs the error via Trace2 and throws with a link to the credential-store documentation.

Solutions

  1. On non-Windows, switch the store: `git config --global credential.credentialStore keychain` (macOS), `secretservice`/`gpg` (Linux), or `cache`/`plaintext` as needed.
  2. Remove the cross-platform wincredman setting from shared/dotfile configs and set it per-OS via conditional includes.
  3. If you actually are on Windows, verify GCM resolved the correct OS (e.g. run inside Windows, not a Linux container).
  4. Use the documentation link from the error to pick a supported store for your platform.

Example fix

// before (.gitconfig shared across OSes)
[credential]
	credentialStore = wincredman

// after (per-OS; Linux example)
[credential]
	credentialStore = gpg
Defensive patterns

Strategy: validation

Validate before calling

bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
var store = "$(git config --global credential.credentialStore)".Trim();
if (!isWindows && store == "wincredman")
    throw new InvalidOperationException("wincredman requires Windows; choose keychain/secret-service/gpg/cache/plaintext");

Try / catch

try
{
    credentialStore.Get(serviceName);
}
catch (Exception ex) when (ex.Message.Contains("Can only use the 'wincredman'"))
{
    // switch to a store valid for the current OS and retry
}

Prevention

When it happens

Trigger: EnsureBackingStore resolves the configured store to wincredman and calls ValidateWindowsCredentialManager while PlatformUtils.IsWindows() is false — e.g. GCM_CREDENTIAL_STORE=wincredman or credential.credentialStore=wincredman on Linux/macOS.

Common situations: Dotfiles/config synced from a Windows machine to WSL, macOS or Linux; CI containers running Linux where the config still names wincredman; team-shared gitconfig that assumes Windows.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of git-ecosystem/git-credential-manager@e8ce762cd0 (2026-09-11). Data as JSON: /api/errors/7dc34f20bc63a277. Report an issue: GitHub.

Appendix: source

Thrown at src/Core/CredentialStore.cs:203

            {
                sb.AppendFormat("  {1,-13} : Git's in-memory credential cache{0}",
                    Environment.NewLine, StoreNames.Cache);
            }

            sb.AppendFormat("  {1,-13} : store credentials in plain-text files (UNSECURE){0}",
                Environment.NewLine, StoreNames.Plaintext);

            sb.AppendFormat("  {1, -13} : disable internal credential storage{0}",
                Environment.NewLine, StoreNames.None);
        }

        private void ValidateWindowsCredentialManager()
        {
            if (!PlatformUtils.IsWindows())
            {
                var message = $"Can only use the '{StoreNames.WindowsCredentialManager}' credential store on Windows.";
                _context.Trace2.WriteError(message);
                throw new Exception(message + Environment.NewLine +
                            $"See {Constants.HelpUrls.GcmCredentialStores} for more information."
                );
            }

            if (!WindowsCredentialManager.CanPersist())
            {
                var message = $"Unable to persist credentials with the '{StoreNames.WindowsCredentialManager}' credential store.";
                _context.Trace2.WriteError(message);
                throw new Exception(message + Environment.NewLine +
                    $"See {Constants.HelpUrls.GcmCredentialStores} for more information."
                );
            }
        }

        private void ValidateDpapi(out string storeRoot)
        {
            if (!PlatformUtils.IsWindows())
            {

View on GitHub (pinned to e8ce762cd0)