I have found a strange error. It is OK when I commit using gpg with git under bash or zsh.
git commit -S -m "xxx"
However when I commit it under tmux, I got:
gpg: signing failed: Operation cancelled gpg: signing failed: Operation cancelled error: gpg failed to sign the data fatal: failed to write commit object