0

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
1

You need to ensure that your GPG_TTY variable is correct; add

GPG_TTY=$(tty)
export GPG_TTY

to your shell startup scripts, including for non-login shells (your login shells are probably OK, but not non-login shells, which is why this fails in tmux).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.