I don't know much about how yubikeys work, but I'm trying to sign a commit with one of them and I don't even know how to debug the problem. I got:
gpg --list-keys
/home/lz/.gnupg/pubring.kbx
---------------------------
pub ed25519 2018-11-30 [SC]
123456...ABCDEF
uid [ unknown] proton@srp.modulus
sub cv25519 2018-11-30 [E]
and
git commit -m "hdle" -S
error: gpg failed to sign the data
fatal: failed to write commit object
and
gpg --status-fd=2 -bsau 'MyName <myname@protonmail.com>'
gpg: skipped "MyName <myname@protonmail.com>": No secret key
[GNUPG:] INV_SGNR 9 MyName <myname@protonmail.com>
[GNUPG:] FAILURE sign 17
gpg: signing failed: No secret key
PS: SSH login works with yubikey
UPDATE:
echo "test" | gpg --clearsign
gpg: no default secret key: No secret key
gpg: [stdin]: clear-sign failed: No secret key