Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automatic gpg signing doesn't seem to work #21

Closed
Sigafoos opened this issue Nov 23, 2020 · 8 comments
Closed

automatic gpg signing doesn't seem to work #21

Sigafoos opened this issue Nov 23, 2020 · 8 comments

Comments

@Sigafoos
Copy link

@Sigafoos Sigafoos commented Nov 23, 2020

I automatically sign all of my commits: my ~/.gitconfig includes

[commit]
	gpgsign = true

When the plugin attempted to commit some changes, I got this error in the console:

git-error.js:32 Uncaught (in promise) Error: error: cannot run gpg: No such file or directory
error: gpg failed to sign the data
fatal: failed to write commit object

    at GitExecutorChain.onFatalException (eval at <anonymous> (app.js:1), <anonymous>:2536:85)
    at GitExecutorChain.eval (eval at <anonymous> (app.js:1), <anonymous>:2527:28)
    at Generator.throw (<anonymous>)
    at rejected (eval at <anonymous> (app.js:1), <anonymous>:2482:65)
@denolehov
Copy link
Owner

@denolehov denolehov commented Nov 23, 2020

hey @Sigafoos, are you on Linux? If so, could you try launching Obsidian from a command line using their AppImage and see if the problem persists?

Or if you're using flatpak:

/home/$USER/.local/share/flatpak/app/md.obsidian.Obsidian/current/active/files/obsidian

@Sigafoos
Copy link
Author

@Sigafoos Sigafoos commented Nov 24, 2020

Unfortunately I'm on a Mac (and Windows, though I haven't tried it there yet)

@danmichaelo
Copy link

@danmichaelo danmichaelo commented Nov 29, 2020

GUI apps on Mac don't read your shell initialization files (.profile, .bashrc etc.), so they generally have a different PATH from what you get in your terminal.

So one solution would be to modify the system-wide PATH variable, but I guess the reason Homebrew or other package managers don't recommend doing this by default, is the risk of conflicts.

My preferred solution is therefore instead to tell git where it can find gpg. First, find out where gpg is located:

$ type gpg
gpg is /usr/local/bin/gpg

Then configure git to use that full path:

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

@Sigafoos
Copy link
Author

@Sigafoos Sigafoos commented Nov 30, 2020

This worked! Thank you so much.

@Sigafoos Sigafoos closed this Nov 30, 2020
@agucova
Copy link

@agucova agucova commented Mar 6, 2021

I'm on Linux using the Flatpak version, with gpgsign = true and gpg.program set to /usr/bin/gpg (where it is on my case), and I can only get it to work while manually running the flatpak binary. If launched through the desktop shortcut, I get the slightly different error:

git-error.js:31 Uncaught (in promise) Error: error: gpg failed to sign the data
fatal: failed to write commit object

    at GitExecutorChain.onFatalException (eval at evalFunc (app.js:1), <anonymous>:2302:85)
    at GitExecutorChain.eval (eval at evalFunc (app.js:1), <anonymous>:2293:28)
    at Generator.throw (<anonymous>)
    at rejected (eval at evalFunc (app.js:1), <anonymous>:2247:65)

@jonatan-ivanov
Copy link

@jonatan-ivanov jonatan-ivanov commented Aug 31, 2021

Fyi, there is another workaround: if you start Obsidian from the terminal where the environment is initialized (PATH), the Obsidian process will see the environment variables, finds gpg and commit works: open /Applications/Obsidian.app.

@dmthepm
Copy link

@dmthepm dmthepm commented Oct 18, 2021

This doesn't seem to work for me. I've installed homebrew so maybe that's a factor. I don't have any files on my computer called gpg. @Sigafoos any suggestions?

`Uncaught (in promise) Error: Pushing to https://github.com/dmthepm/garden.git
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/dmthepm/garden.git'

at Object.action (eval at <anonymous> (app.js:1), <anonymous>:2971:33)
at PluginStore.exec (eval at <anonymous> (app.js:1), <anonymous>:3003:33)
at eval (eval at <anonymous> (app.js:1), <anonymous>:3407:45)
at new Promise (<anonymous>)
at GitExecutorChain.handleTaskData (eval at <anonymous> (app.js:1), <anonymous>:3405:16)
at GitExecutorChain.eval (eval at <anonymous> (app.js:1), <anonymous>:3389:46)
at Generator.next (<anonymous>)
at fulfilled (eval at <anonymous> (app.js:1), <anonymous>:3317:58)
at processTicksAndRejections (internal/process/task_queues.js:93)`

@dmthepm
Copy link

@dmthepm dmthepm commented Oct 18, 2021

I've got two files in /localmachine/ruby -v/Library/Taps/homebrew/homebrew-core/Formula called gpg-tui.rb
& gpgme.rb. Maybe it's one of those?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants