{"record":{"id":"a84fc927a7555bec","repo":"git-ecosystem/git-credential-manager","slug":"cannot-find-gpg-id-in-password-store-at-storeroo","errorCode":null,"errorMessage":"Cannot find GPG ID in password store at '{StoreRoot}'; run `pass init <gpg-id>` to initialize the store.","messagePattern":"Cannot find GPG ID in password store at '(.+?)'; run `pass init <gpg-id>` to initialize the store\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Core/Interop/Posix/GpgPassCredentialStore.cs","lineNumber":52,"sourceCode":"                if (FileSystem.FileExists(gpgIdPath))\n                {\n                    using (var stream = FileSystem.OpenFileStream(gpgIdPath, FileMode.Open, FileAccess.Read, FileShare.Read))\n                    using (var reader = new StreamReader(stream))\n                    {\n                        return reader.ReadLine();\n                    }\n                }\n\n                // Stop after checking the store root\n                if (FileSystem.IsSamePath(dir, StoreRoot))\n                {\n                    break;\n                }\n\n                dir = Path.GetDirectoryName(dir);\n            }\n\n            throw new Exception($\"Cannot find GPG ID in password store at '{StoreRoot}'; run `pass init <gpg-id>` to initialize the store.\");\n        }\n\n        protected override bool TryDeserializeCredential(string path, out FileCredential credential)\n        {\n            string text = _gpg.DecryptFile(path);\n\n            int line1Idx = text.IndexOf(Environment.NewLine, StringComparison.OrdinalIgnoreCase);\n            if (line1Idx > 0)\n            {\n                // Password is the first line\n                string password = text.Substring(0, line1Idx);\n\n                // All subsequent lines are metadata/attributes\n                string attrText = text.Substring(line1Idx + Environment.NewLine.Length);\n                using var attrReader = new StringReader(attrText);\n                IDictionary<string, string> attrs = attrReader.ReadDictionary(StringComparer.OrdinalIgnoreCase);\n\n                // Account is optional","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Core/Interop/Posix/GpgPassCredentialStore.cs#L34-L70","documentation":"GetGpgId walks up from a password-store path looking for a .gpg-id file whose contents identify the GPG key used to encrypt credentials. If it reaches the store root (or filesystem root) without finding one, it throws because the `pass` store was never initialized. This exception prevents encrypting credentials with an unknown key.","triggerScenarios":"Using the GpgPassCredentialStore ('gpg'/'pass' credential store) against a directory that lacks a .gpg-id file anywhere between the credential path and StoreRoot — i.e. `pass init <gpg-id>` was never run for that store.","commonSituations":"Manually creating the password-store directory instead of running `pass init`; setting credentialStore=gpg but pointing at an empty or wrong directory; cloning a pass store without the .gpg-id file; typo'd credentialStoreRootPath.","solutions":["Initialize the store: `pass init <your-gpg-id>` (writes .gpg-id at the store root).","If the store exists elsewhere, set the credential store root path configuration to the directory containing .gpg-id.","Verify a .gpg-id file exists and is non-empty: `cat ~/.password-store/.gpg-id`.","If you don't use pass, switch credential.credentialStore to cache, plaintext, or another supported store."],"exampleFix":"// before\n// store directory created manually, no .gpg-id\nmkdir -p ~/.password-store\n// after\npass init user@example.com   # creates ~/.password-store/.gpg-id","handlingStrategy":"validation","validationCode":"string FindGpgId(string storeRoot) {\n    var p = Path.Combine(storeRoot, \".gpg-id\");\n    if (!File.Exists(p)) throw new InvalidOperationException(\n        $\"{storeRoot} is not initialized; run: pass init <gpg-id>\");\n    if (string.IsNullOrWhiteSpace(File.ReadAllText(p).Trim()))\n        throw new InvalidOperationException(\".gpg-id is empty; re-run: pass init <gpg-id>\");\n    return p;\n}","typeGuard":null,"tryCatchPattern":"try { store.Save(cred); }\ncatch (Exception ex) when (ex.Message.Contains(\"Cannot find GPG ID\"))\n{ Console.Error.WriteLine(\"Run 'pass init <gpg-id>' first.\"); return 1; }","preventionTips":["Always create a pass store with `pass init <gpg-id>`, never by hand with mkdir.","Add a startup check for the presence of .gpg-id before configuring the gpg credential store.","When sharing stores across machines, ensure .gpg-id is committed/synced with the store.","Verify GPG key availability: gpg --list-keys <gpg-id>."],"tags":["gpg","pass","credentials","posix","configuration"],"backgroundTag":"missing-required-config-field","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"}