如果我设置Git使用我的GPG密钥进行签名,则会失败。我尝试了GIT_TRACE,但它并没有给我更多的信息:
$ GIT_TRACE=1 git commit
15:29:35.112157 git.c:344 trace: built-in: git 'commit'
15:29:35.115745 run-command.c:626 trace: run_command: 'code --wait' '/Users/b/VurbAgency/haarlem.github.io/.git/COMMIT_EDITMSG'
15:29:52.884006 run-command.c:626 trace: run_command: 'gpg' '--status-fd=2' '-bsau' 'SECRETKEYID'
error: gpg failed to sign the data
fatal: failed to write commit object
当我尝试运行'gpg' '--status-fd=2' '-bsau' 'SECRETKEYID'
时,它只是在说完BEGIN_SIGNING H8
后就停止工作了,什么也没有做。
有什么解决方法或者研究途径吗?
export GPG_TTY=$(tty)
时,对我来说没有任何反应。 - ReinstateMonica3167040gpg-connect-agent updatestartuptty /bye >/dev/null
和export GPG_TTY=$(tty)
添加到我的.bashrc
中,这样才能正确显示GPG密码提示 (gpg --status-fd=2 -bsau <id>
)。在Arch Wiki上找到了解决方法:https://wiki.archlinux.org/title/GnuPG#Configure_pinentry_to_use_the_correct_TTY - Andreas Nasman