{"record":{"id":"6c14e4757c6603c3","repo":"jesseduffield/lazygit","slug":"git-command-failed-check-command-log-for-details","errorCode":null,"errorMessage":"Git command failed. Check command log for details (open with %s)","messagePattern":"Git command failed\\. Check command log for details \\(open with (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gui/controllers/helpers/gpg_helper.go","lineNumber":92,"sourceCode":"\n\t\treturn err\n\t}\n\n\treturn self.runAndStream(\n\t\tcmdObj, waitingStatus, onSuccess, failureRefreshOptions, successRefreshOptions)\n}\n\nfunc (self *GpgHelper) runAndStream(\n\tcmdObj *oscommands.CmdObj,\n\twaitingStatus string,\n\tonSuccess func() error,\n\tfailureRefreshOptions types.RefreshOptions,\n\tsuccessRefreshOptions types.RefreshOptions,\n) error {\n\treturn self.c.WithWaitingStatus(waitingStatus, func(gocui.Task) error {\n\t\tif err := cmdObj.StreamOutput().Run(); err != nil {\n\t\t\tself.c.RefreshFromWorker(failureRefreshOptions)\n\t\t\treturn fmt.Errorf(\n\t\t\t\tself.c.Tr.GitCommandFailed, self.c.UserConfig().Keybinding.Universal.ExtrasMenu,\n\t\t\t)\n\t\t}\n\n\t\tif onSuccess != nil {\n\t\t\tif err := onSuccess(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tself.c.RefreshFromWorker(successRefreshOptions)\n\t\treturn nil\n\t})\n}\n","sourceCodeStart":74,"sourceCodeEnd":107,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/controllers/helpers/gpg_helper.go#L74-L107","documentation":"GpgHelper.runAndStream (pkg/gui/controllers/helpers/gpg_helper.go) runs a git command with streamed output inside WithWaitingStatus (used for signing operations like creating a signed commit or tag). If the command exits non-zero it refreshes with failure options and returns the translated GitCommandFailed message pointing at the command log, which is opened with the ExtrasMenu keybinding.","triggerScenarios":"Creating/adjusting a signed commit or tag when the underlying `git commit -S` / `git tag -s` fails: missing GPG secret key, expired key, gpg not installed, pinentry cannot ask for the passphrase in the TUI, or commit.gpgsign=true with no signing key configured.","commonSituations":"Fresh machines without the signing key imported; ssh/gpg-agent forwarding not set up over SSH; commit.gpgsign enabled globally while working on a repo without signing configured; pinentry-tty vs pinentry mismatches.","solutions":["Open the command log with the extras menu key (shown in the error, default '@') and read the actual git stderr.","If it is a key problem: gpg --list-secret-keys --keyid-format long, ensure the key exists and git config user.signingkey points at it.","Test outside lazygit with the same command (e.g. git commit -S --amend --no-edit) to reproduce and fix the gpg error.","For SSH sessions, enable gpg-agent forwarding or use pinentry-tty; as a stopgap, temporarily unset commit.gpgsign for the repo."],"exampleFix":"# terminal\n# verify a signing key exists and is usable\ngpg --list-secret-keys --keyid-format long\ngit config --global user.signingkey <KEYID>\ngit commit -S --allow-empty -m test  # reproduce outside lazygit","handlingStrategy":"try-catch","validationCode":"// Precondition check before a signed operation:\nif signingKey, _ := gitConfig(\"user.signingkey\"); signingKey == \"\" {\n\treturn errors.New(\"user.signingkey unset; signed commits will fail\")\n}","typeGuard":null,"tryCatchPattern":"if err := runSignedGitCmd(); err != nil {\n\tlog.Debugf(\"stderr captured in command log: %v\", err)\n\treturn fmt.Errorf(\"git failed; open the command log with %s\", extrasKey)\n}","preventionTips":["Import signing keys before first use; verify with gpg --list-secret-keys.","Test `git commit -S --allow-empty -m t` outside lazygit after key/agent changes.","Set up gpg-agent or pinentry-tty for SSH/headless sessions."],"tags":["git","gpg","signing","commit"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}