Git提交错误:无法产生gpg.exe:没有这样的文件或目录

时间:2020-11-02 17:05:17

标签: git git-commit gnupg git-sign

这是我尝试提交任何文件时作为输出得到的结果。我尝试再次安装git,并在youtube上观看了一些教程,以重新启动它,但是没有用。仍然出现相同的错误:

error: cannot spawn C:\Program Files (x86)\GnuPG\bin\gpg.exe: No such file or directory
error: gpg failed to sign the data
fatal: failed to write commit object

2 个答案:

答案 0 :(得分:0)

从错误消息来看:

error: cannot spawn C:\Program Files (x86)\GnuPG\bin\gpg.exe: No such file or directory
error: gpg failed to sign the data fatal: failed to write commit object

您已打开git gpg signing,但未安装GnuPG。安装它或关闭提交gpg签名。您可以在特定的提交命令上使用--no-gpg-sign标志来禁用提交签名:

git commit --no-gpg-sign

disable it permanently,方法是修改全局.gitconfig

git config --global commit.gpgsign false

答案 1 :(得分:0)

如果您在 Windows 中使用 Git bash 生成密钥而不是 GnuPG Win,那么您需要更新 git 配置以指向 gnupg 的正确位置。在 git bash 中使用正确的位置运行以下命令。

git config --global gpg.program /usr/bin/gpg

如果您不知道位置,请在 git bash 中运行 which gpg 以获取位置。