brew install pinentry-mac
If not existing already create the file ~/.gnupg/gpg-agent.conf and add the following line:
pinentry-program /usr/local/bin/pinentry-mac
gpgconf --kill gpg-agent
-
https://samuelsson.dev/sign-git-commits-on-github-with-gpg-in-macos/