【问题标题】:Git commit error: cannot spawn gpg.exe: No such file or directoryGit提交错误:无法生成gpg.exe:没有这样的文件或目录
【发布时间】:2021-02-15 08:58:35
【问题描述】:

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

错误:无法生成 C:\Program Files (x86)\GnuPG\bin\gpg.exe:没有这样的文件或目录 错误:gpg 未能签署数据 致命:未能写入提交对象

【问题讨论】:

    标签: git git-commit gnupg git-sign


    【解决方案1】:

    从错误信息来看:

    错误:无法生成 C:\Program Files (x86)\GnuPG\bin\gpg.exe:没有这样的文件或目录 错误:gpg 未能签署数据致命:未能写入提交对象

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

    git commit --no-gpg-sign

    disable it permanently 修改您的全局.gitconfig

    git config --global commit.gpgsign false

    【讨论】:

      【解决方案2】:

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

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

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

      【讨论】:

        【解决方案3】:

        我也遇到了这个问题,并且能够通过删除 .gitconfig 文件中 gpg.exe 程序行的引号来解决它。

        更新前的.gitconfig文件=>

        [gpg] 程序 = 'C:\Users\TEST\AppData\Local\GnuPG\bin\gpg.exe'

        .gitconfig 更新后的文件 =>

        [gpg] 程序 = C:\Users\TEST\AppData\Local\GnuPG\bin\gpg.exe

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-02-14
          • 1970-01-01
          • 2023-04-11
          • 1970-01-01
          相关资源
          最近更新 更多