问题描述
我在git和使用GPG密钥签署提交时遇到问题.
I have an issue with git and signing commits with GPG key.
我有一个主密钥(仅用于认证).我已经为每台计算机创建了两个子项(仅用于签名).我已将公钥添加到Github,并使用user.signingKey
配置选项配置了git.
I have a master key (used for certification only). I've created two subkeys (only for signing) per computer. I've added public key to Github, configured git by using user.signingKey
configuration option.
问题在于git似乎忽略了配置选项,并一直使用最新的子项(列表gpg --list-secret-keys EMAIL
中的最新项).
The issue is that git seems to be ignoring the configuration option and uses the newest subkey all the time (the latest on the list gpg --list-secret-keys EMAIL
).
我已经在两个环境中检查了这个问题.我正在使用以下git版本:git version 2.15.1
I've checked it on two environments, same issue. I'm using the following git version: git version 2.15.1
有任何线索吗?
推荐答案
要使用特定的子项,必须在KEYID后面附加!
.因此配置应如下所示:
To use a specific subkey, KEYID must be appended with !
. So the configuration should look like the following:
[user]
name = Andrzej Ośmiałowski
email = [email protected]
signingKey = KEYID!
非常感谢 Todd Zullinger 在Git邮件列表上提供了解决方案.
Many thanks to Todd Zullinger to provide the solution on Git mailing list.
这篇关于Git使用错误的子密钥与GPG密钥签署提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!