在 git 中看到 "this user has not yet uploaded their public key" 提交,但我的 gpg 密钥已上传

Seeing "this user has not yet uploaded their public key" in git commits, but my gpg key is uploaded

我目前在我的 Git 提交附近看到这条消息,即使我正在使用“git commit -S”签署它们:

当我检查“设置”>“SSH 和 GPG 密钥”时,我看到相同的 GPG 密钥 ID(见下文)。

当我 运行 $git config --global user.signingkey 时,我得到以下结果。我添加了 Xs 和 Ys 来隐藏实际值,但前半部分是“子键”中列出的键(来自上面的屏幕截图),后半部分是“键 ID”中列出的键(同样,来自以上截图):

01XXXXXXXXXXXXXXXXXXXXAYYYYYYYYYYYYYA012

我还需要做什么才能使我的提交显示为已验证?

如“Statuses with vigilant mode enabled”中所述

Unverified means any of the following is true:

  • The commit is signed but the signature could not be verified.
  • The commit is not signed and the committer has enabled vigilant mode.
  • The commit is not signed and an author has enabled vigilant mode.

在签署提交时仔细检查本地实际使用的密钥。

如“Signing commits”中所述

If you have multiple keys or are attempting to sign commits or tags with a key that doesn't match your committer identity, you should tell Git about your signing key.

检查 git config --global user.signingkey(如


OP WEFX adds in :

I think my problem was my global config email address was set to a different email address.
I fixed that, created a new GPG key, and started over w/ a new branch as well.
Now, my commits are listed as "Verified", and I'm able to push.

我认为我的具体问题是由我的配置电子邮件地址与 GPG 密钥上的电子邮件地址不匹配引起的。我通过 运行 这个检查了我的电子邮件:

git config --global user.email

并注意到返回的电子邮件是我的备用电子邮件地址。我将电子邮件值设置为正确的地址,生成了一个新密钥,开始了一个新分支,现在我所有的提交都列为“已验证”。更重要的是,我还可以推送到所需的分支!

(注意 - 我不确定是否 100% 需要生成新密钥和新分支等。我只是想开始清理并消除更多问题)