I had a problem similar to Key sign problem. Maybe in that case the fix was easy, just supplying the secret key.
In my case this was a fresh install into a new Debian/sid system (so gpg2 is the default) and the failure happened during the propellor --init following the directions in the quick start at https://propellor.branchable.com/. During the --init I selected to create a gpg key. The message, after finally getting enough entropy and creating the gpg key, was: error:gpg failed to sign the data fatal: failed to write commit object
So it was frustrating that propellor didn't work out of the box and there were no hints what was wrong with signing commits in git (the error above is from git and doing git commit -S was enough to reproduce it).
The issue has to do with prompting for a passphrase in gpg2. If the agent is running and $GPG_TTY is set correctly you get a prompt and things will work. I was able to convince myself that if the agent wasn't running it would cause this error but it seems that gpg2 requires the agent and automatically starts it so I'm not sure how I managed that.
Initially I was trying propellor before I installed a desktop so I don't know what I had for the gpg agent or how it should have been prompting. There doesn't seem to be much help out there on gpg2 + git failures but I'll keep looking.