'error: gpg failed to sign the data (in mac)

I am trying to commit with gpg.

git config --global user.signingkey (key) # is added as a global user.

git config --global commit.gpgsign (value) # is true.

gpgconf --kill gpg-agent # didn't work for me.

And the weirdest thing is that when doing the test with echo "test" | gpg --clearsign doesn't give me any errors.

git output is exactly this when committing:

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file - -S error: gpg failed to sign the data fatal: failed to write commit object



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source