Problem
GUI apps on macOS (e.g. Obsidian with the Git plugin) do not inherit the shell PATH, so git cannot find the gpg binary and commit signing fails with:
error: cannot run gpg: No such file or directory
error: gpg failed to sign the data
Fix
Set gpg.program to the absolute path in ~/.gitconfig:
gpg.program = /opt/homebrew/bin/gpg
This should be added to the machine setup script or dotfiles so it is applied automatically on new machines.
Also added
Export GPG_TTY=$(tty) in ~/.zshrc for terminal-based GPG sessions.
Problem
GUI apps on macOS (e.g. Obsidian with the Git plugin) do not inherit the shell PATH, so git cannot find the gpg binary and commit signing fails with:
Fix
Set gpg.program to the absolute path in ~/.gitconfig:
This should be added to the machine setup script or dotfiles so it is applied automatically on new machines.
Also added
Export GPG_TTY=$(tty) in ~/.zshrc for terminal-based GPG sessions.