我按照Github上的说明设置了Git签名,但是当我尝试签名和提交时,我得到了以下错误。我在网上搜索了一下,但我不知道为什么--help
被包含在签名命令中。我使用的是Mac(M2),Git版本是2.40.1
╭─rishabh@WKW305277K ~/Development/src ‹feature/list-by-currency*›
╰─➤ GIT_TRACE=1 git commit -m "Initial commit"
13:02:32.970213 git.c:439 trace: built-in: git commit -m 'Initial commit'
13:02:32.991133 run-command.c:655 trace: run_command: --help --status-fd=2 -bsau 6C3C23C559AA013D352F8790061E0F7BCE5EABB8
error: cannot run --help: No such file or directory
error: gpg failed to sign the data:
(no gpg output)
fatal: failed to write commit object
为了帮助调试问题,以下是所需的信息:
~/.gitconfig
的含量
╭─rishabh@WKW305277K ~
╰─➤ cat ~/.gitconfig
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
[user]
name = Rishabh
email = rishabh@example.com
signingkey = 6C3C23C559AA013D352F8790061E0F7BCE5EABB8
[init]
defaultBranch = master
[pull]
rebase = false
[commit]
template = /Users/rishabh/.gitmessage
gpgsign = true
[core]
excludesfile = /Users/rishabh/.gitignore_global
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[gpg]
program = /opt/homebrew/opt/gnupg@2.2/bin/gpg
gpg --status-fd=2 -bsau <key>
的输出
╭─rishabh@WKW305277K ~
╰─➤ gpg --status-fd=2 -bsau 6C3C23C559AA013D352F8790061E0F7BCE5EABB8
[GNUPG:] KEY_CONSIDERED 6C3C23C559AA013D352F8790061E0F7BCE5EABB8 2
[GNUPG:] BEGIN_SIGNING H8
^C
gpg: signal Interrupt caught ... exiting
2条答案
按热度按时间dced5bon1#
该解决方案要求我检查各个存储库上
git config --global gpg.program
和git config gpg.program
的输出,然后我注意到在各个存储库上有以下内容:我通过将值设置为下面的值来纠正它,它纠正了我的问题。
7cjasjjr2#
使用此命令调试问题:
这可能是因为gpg密钥已过期或gpg密钥未正确设置。
根据此答案,您可以更新它:
或者您可以通过列出密钥来设置它,然后为用户添加密钥: