本文介绍了“没有秘密密钥"在Windows上签名git commit时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试签署提交时出现此错误:

I'm getting this error when trying to sign a commit:

git commit -S -m "test"
gpg: skipped "EF617ACA9EC3XXXX": No secret key
gpg: signing failed: No secret key
error: gpg failed to sign the data
fatal: failed to write commit object

这是gpg --list-secret-keys --keyid-format LONG的输出

This is the output of gpg --list-secret-keys --keyid-format LONG

钥匙在那儿

sec   rsa4096/EF617ACA9EC3XXXX 2020-05-17 [SC] [expires: 2022-05-17]
      AD68154000A712DCD161D826EF617ACA9EC3XXXX
uid                 [ultimate] name <[email protected]>

这是具有相同键的git config

And this is git config with the same key

user.signingkey=EF617ACA9EC3XXXX
[email protected]

你知道怎么了吗?

推荐答案

首先检查 git config gpg.program 来查看这是 gpg 还是 gpg2 (如在此处).

Check first the git config gpg.program to see if this is gpg or gpg2 (as in here).

然后输入 where gpg where gpg2 来检查GPG程序考虑的路径.

And type where gpg nd where gpg2 to check which path is considered for the GPG program.

我建议将 gpg.program 设置为 gpg2 ,然后复制您的 gpg.exe (假设其版本为2.x)到 gpg2.exe

I suggested to set gpg.program to gpg2, and copy your gpg.exe (assuming its version is a 2.x) to gpg2.exe

这应该强制Git/GPG充当gpg2.

That should force Git/GPG to act as gpg2.

这篇关于“没有秘密密钥"在Windows上签名git commit时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-14 16:31