即使它是Git,Git也不认为gpg密钥是秘密的,我该如何解决? [英] Git doesn't see gpg key as secret, even though it is, how do I fix it?

查看:235
本文介绍了即使它是Git,Git也不认为gpg密钥是秘密的,我该如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以看来我的gpg密钥是秘密的,但是当我尝试在git中签名我的提交时,它并不被认为是秘密的.我完全不知道为什么会这样.我相信我已经正确设置了此设置,但是我的提交标志失败了.难道我做错了什么?预先感谢您的帮助.

So it seems that my gpg key is secret but when I try to sign my commits in git, it isn't recognized as secret. I'm at a total loss for why this is. I believe I have this setup properly but my commit signs fail. Am I doing something wrong? Thanks in advance for any help.

[brad@reason entry-criteria-test]$ gpg --list-secret-keys --keyid-format LONG
/home/brad/.gnupg/secring.gpg
-----------------------------
sec   4096R/15980D34B4EED3FA 2019-03-11
uid                          Brad <brad@work.com>
ssb   4096R/3B437BF0F7366F6C 2019-03-11

[brad@reason entry-criteria-test]$ git config user.signingkey 15980D34B4EED3FA
[brad@reason entry-criteria-test]$ git config --global user.signingkey 15980D34B4EED3FA
[brad@reason entry-criteria-test]$ git commit -S -m "testing signed commit"
gpg: key B4EED3FA: secret key without public key - skipped
gpg: skipped "15980D34B4EED3FA": No secret key
gpg: signing failed: No secret key
error: gpg failed to sign the data
fatal: failed to write commit object
[brad@reason entry-criteria-test]$ git config -l
user.name=Brad
user.email=brad@work.com
user.signingkey=15980D34B4EED3FA
color.ui=true
push.default=simple
commit.gpgsign=true
gpg.program=gpg2
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git@github.work.com:entry-criteria-test.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
branch.issue-00142.remote=origin
branch.issue-00142.merge=refs/heads/issue-00142
branch.issue-00144.remote=origin
branch.issue-00144.merge=refs/heads/issue-00144
commit.gpgsign=true
user.signingkey=15980D34B4EED3FA

推荐答案

问题出在:

gpg.program=gpg2

即使我已经安装了gpg 2.2.13,git仍然想使用gpg.这种方式很有意义,因为我上面在gnupg上使用的所有命令都使用gpg而不是gpg2.因此,如果遇到此问题,请检查gpg2和gpg密钥是否不同.

Even though I have gpg 2.2.13 installed, git still wants to use gpg. This kind of makes sense as all the commands I used above for gnupg use gpg not gpg2. So if you're having this problem check to see if your gpg2 and gpg keys are different.

gpg --list-secret-keys --keyid-format LONG
gpg2 --list-secret-keys --keyid-format LONG
git config -l

这些不同吗?正确的gpg中的正确键是否与您的git配置匹配?

Are these different? Does the right key from the right gpg match your git config?

这篇关于即使它是Git,Git也不认为gpg密钥是秘密的,我该如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆