Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

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

Trying to commit my changes by using GitHub Desktop and getting this:

enter image description here

error: cannot run gpg: No such file or directory

error: could not run gpg.

fatal: failed to write commit object (128)

Firstly that not worked for terminal too and i create gpg-key and plugged in to my GitHub Account Now it's working well in Terminal but Desktop version still not working.

In Oficial doccumentation for GitHub Desktop i found some notation:

Note: GitHub Desktop does not support GPG signing.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 - <$signature" is run, and the program is expected to signal a good signature by exiting with code 0, and to generate an ASCII-armored detached signature, the standard input of "gpg -bsau $key" is fed with the contents to be signed, and the program is expected to send the result to its standard output. 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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...