{"record":{"id":"7dc34f20bc63a277","repo":"git-ecosystem/git-credential-manager","slug":"can-only-use-the-storenames-windowscredentialman","errorCode":null,"errorMessage":"Can only use the '{StoreNames.WindowsCredentialManager}' credential store on Windows.\nSee {Constants.HelpUrls.GcmCredentialStores} for more information.","messagePattern":"Can only use the '(.+?)' credential store on Windows\\.\nSee (.+?) for more information\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Core/CredentialStore.cs","lineNumber":203,"sourceCode":"            {\n                sb.AppendFormat(\"  {1,-13} : Git's in-memory credential cache{0}\",\n                    Environment.NewLine, StoreNames.Cache);\n            }\n\n            sb.AppendFormat(\"  {1,-13} : store credentials in plain-text files (UNSECURE){0}\",\n                Environment.NewLine, StoreNames.Plaintext);\n\n            sb.AppendFormat(\"  {1, -13} : disable internal credential storage{0}\",\n                Environment.NewLine, StoreNames.None);\n        }\n\n        private void ValidateWindowsCredentialManager()\n        {\n            if (!PlatformUtils.IsWindows())\n            {\n                var message = $\"Can only use the '{StoreNames.WindowsCredentialManager}' credential store on Windows.\";\n                _context.Trace2.WriteError(message);\n                throw new Exception(message + Environment.NewLine +\n                            $\"See {Constants.HelpUrls.GcmCredentialStores} for more information.\"\n                );\n            }\n\n            if (!WindowsCredentialManager.CanPersist())\n            {\n                var message = $\"Unable to persist credentials with the '{StoreNames.WindowsCredentialManager}' credential store.\";\n                _context.Trace2.WriteError(message);\n                throw new Exception(message + Environment.NewLine +\n                    $\"See {Constants.HelpUrls.GcmCredentialStores} for more information.\"\n                );\n            }\n        }\n\n        private void ValidateDpapi(out string storeRoot)\n        {\n            if (!PlatformUtils.IsWindows())\n            {","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Core/CredentialStore.cs#L185-L221","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["On non-Windows, switch the store: `git config --global credential.credentialStore keychain` (macOS), `secretservice`/`gpg` (Linux), or `cache`/`plaintext` as needed.","Remove the cross-platform wincredman setting from shared/dotfile configs and set it per-OS via conditional includes.","If you actually are on Windows, verify GCM resolved the correct OS (e.g. run inside Windows, not a Linux container).","Use the documentation link from the error to pick a supported store for your platform."],"exampleFix":"// before (.gitconfig shared across OSes)\n[credential]\n\tcredentialStore = wincredman\n\n// after (per-OS; Linux example)\n[credential]\n\tcredentialStore = gpg","handlingStrategy":"validation","validationCode":"bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);\nvar store = \"$(git config --global credential.credentialStore)\".Trim();\nif (!isWindows && store == \"wincredman\")\n    throw new InvalidOperationException(\"wincredman requires Windows; choose keychain/secret-service/gpg/cache/plaintext\");","typeGuard":null,"tryCatchPattern":"try\n{\n    credentialStore.Get(serviceName);\n}\ncatch (Exception ex) when (ex.Message.Contains(\"Can only use the 'wincredman'\"))\n{\n    // switch to a store valid for the current OS and retry\n}","preventionTips":["Use git conditional includes (includeIf os/linux etc.) for per-OS credentialStore values.","Keep wincredman out of shared dotfiles.","Pick the store per platform in provisioning scripts.","Document expected store per environment (laptop vs CI)."],"tags":["git","credential-store","platform","configuration"],"backgroundTag":"unsupported-platform","analyzedSha":"e8ce762cd04b4100ae637b5fbf39ef9d0a96561e","analyzedAt":"2026-09-11T17:15:08.753Z","contentChangedAt":"2026-09-11T17:15:08.753Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}