0

I am failing to run gpg to sign commits, after doing so successfully before an upgrade to Mojave and an upgrade to Emacs. (I am not sure when I lost the ability to sign files in the past year.)

When I attempt to sign commits now this happens:

GitError! failed to write commit object  [Type `$' for details]

When I expand the '$' for details, I get this:

  0 git … commit --amend --only
hint: Waiting for your editor to close the file...
Waiting for Emacs...
[master e61729b] Master SQLite DB in ~/ingest.
 Date: Tue Sep 17 17:35:07 2019 -0500
 2 files changed, 70 insertions(+), 8 deletions(-)

128 git … commit --amend --only
hint: Waiting for your editor to close the file...
Waiting for Emacs...
error: cannot run gpg: No such file or directory
error: gpg failed to sign the data
fatal: failed to write commit object

My searches for fixes related to GNU gpg and the new Transient library and suggestions for that switchover in the Magit source have not led to a solution.

What I am looking for

I am interested in determining

  • How Emacs finds the paths to use gpg in Magit to run this command so that I can debug the configuration. Answered in the comment, incorporated below:

    (setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin")) (setq exec-path (append exec-path '("/usr/local/bin")))

  • How can I see where the paths are that Emacs and GPG can use internally when running any command?

I am interested in the solutions that others have had to this issue.

Versions of software and OS.

magit-version returns the following string

Magit 2.90.1 Git 2.20.1 (Apple Git-117), Emacs 26.1, darwin
on an iMac Pro (2017) running OS X 10.14.6

Version of Emacs: Emacs 26.1 (9.0)
https://www.gnu.org/software/emacs

Additional information - Added 2019-09-20 Friday

I solved the above issue with this correction:

Emacs EPA and Gnupg2 no usable configuration

(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
(setq exec-path (append exec-path '("/usr/local/bin")))
  • I think magit just tells git to run gpg (i.e., Emacs never runs gpg directly for this use case), so only (getenv "PATH") should be relevant. – npostavs Sep 20 at 1:06
  • I solved the above issue with this correction Please post an answer describing how you fixed the issue. New issue: ... Please post that as an independent question. – tarsius Sep 21 at 8:10
0

error: cannot run gpg: No such file or directory

This means "I cannot find gpg and therefore cannot run it", i.e. that gpg either isn't installed at all (which is unlikely) or that it is not located on the PATH where processes look for executables they intend to run as subprocesses.

Based on what you have posted above that directory happens to be /usr/local/bin, which is a directory that should really be placed on PATH; it isn't obscure at all.

To teach emacs about that directory the exec-path lisp variable has to be used, to teach other processes (including git) to do so the environment variable PATH has to be set. Something like:

(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
(setq exec-path (append exec-path '("/usr/local/bin")))
  • Thanks for the administrative oversight to post the answer separately. I will post the issue with Magit and viewing signatures as a separate issue. – sanug Sep 26 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.