Git Hub Desktop on Mac, error: cannot run gpg: No such file or directory

半城伤御伤魂 提交于 2019-11-28 19:13:27

Solved it.

So as GitHub Desktop was complaining about not being able to find gpg (I had installed it via homebrew), I figured there should be a way to tell git the exact path of gpg, turns out there is:

gpg.program Use this custom program instead of "gpg" found on $PATH when making or verifying a PGP signature. The program must support the same command-line interface as GPG, namely, to verify a detached signature, "gpg --verify $file - https://git-scm.com/docs/git-config

So running the following solved the problem:

git config --global gpg.program $(which gpg)

GitHub got back to me and said that some users also need to use:

echo "no-tty" >> ~/.gnupg/gpg.conf

It has something to do with commit signing (https://help.github.com/en/articles/signing-commits).

In case you use Github Desktop (which doesn't support commit signing as highlighted right at the beginning of the article linked above) or if you don't need commit signing (or don't even know what it is), one thing you can do is to disable gpg commit signing by running a command like git config --global commit.gpgsign false or edit your .git/config file manually:

[commit]
  # https://help.github.com/articles/signing-commits-using-gpg/
  gpgsign = false

Hope it helps someone.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!