{"record":{"id":"9314973b021e4357","repo":"git-ecosystem/git-credential-manager","slug":"can-only-use-the-storenames-macoskeychain-cred","errorCode":null,"errorMessage":"Can only use the '{StoreNames.MacOSKeychain}' credential store on macOS.\nSee {Constants.HelpUrls.GcmCredentialStores} for more information.","messagePattern":"Can only use the '(.+?)' credential store on macOS\\.\nSee (.+?) for more information\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Core/CredentialStore.cs","lineNumber":247,"sourceCode":"            // Check for a redirected credential store location\n            if (!_context.Settings.TryGetSetting(\n                Constants.EnvironmentVariables.GcmDpapiStorePath,\n                Constants.GitConfiguration.Credential.SectionName,\n                Constants.GitConfiguration.Credential.DpapiStorePath,\n                out storeRoot))\n            {\n                // Use default store root at ~/.gcm/dpapi_store\n                storeRoot = Path.Combine(_context.FileSystem.UserDataDirectoryPath, \"dpapi_store\");\n            }\n        }\n\n        private void ValidateMacOSKeychain()\n        {\n            if (!PlatformUtils.IsMacOS())\n            {\n                var message = $\"Can only use the '{StoreNames.MacOSKeychain}' credential store on macOS.\";\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 ValidateSecretService()\n        {\n            if (!PlatformUtils.IsLinux())\n            {\n                var message = $\"Can only use the '{StoreNames.SecretService}' credential store on Linux.\";\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 (!_context.SessionManager.IsDesktopSession)\n            {","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Core/CredentialStore.cs#L229-L265","documentation":"GCM's CredentialStore.ValidateMacOSKeychain throws this generic Exception when the credential store type is explicitly configured to '{macOSKeychain}' but the host is not macOS. The macOS Keychain backing store only exists on macOS, so selecting it elsewhere is a configuration error caught before any credential operation runs.","triggerScenarios":"Setting credential.store (or GCM_CREDENTIAL_STORE) to StoreNames.MacOSKeychain on Windows or Linux; EnsureBackingStore dispatches to ValidateMacOSKeychain which fails the PlatformUtils.IsMacOS() check.","commonSituations":"Copying a .gitconfig or GCM env config from a Mac to a Linux CI box or Windows machine; documentation snippets assuming macOS; team-shared config files that pin the store type.","solutions":["Remove the credential.store / GCM_CREDENTIAL_STORE setting so GCM auto-selects the platform default store.","Set credential.store to the correct store for the OS (e.g. 'wincredman' on Windows, 'secretservice' or 'gpg'/'cache' on Linux).","If config must be shared, scope the macOS-specific store setting to a per-machine include (includeIf) rather than globally."],"exampleFix":"// before (Linux ~/.gitconfig)\n[credential]\n\tstore = macOSkeychain\n// after\n[credential]\n\t# let GCM pick the platform default\n\t# store = secretservice","handlingStrategy":"validation","validationCode":"const isMac = process.platform === 'darwin';\nif (storeType === 'macOSKeychain' && !isMac) {\n  throw new Error('macOSKeychain credential store requires macOS');\n}","typeGuard":"const isValidStoreForPlatform = (store: string) =>\n  store !== 'macOSKeychain' || process.platform === 'darwin';","tryCatchPattern":null,"preventionTips":["Never hardcode credential.store in shared config files; let GCM pick the platform default","Use git includeIf per-OS for store overrides","Run `git-credential-manager diagnose` to check store availability"],"tags":["git-credential-manager","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"}