obsidian-git icon indicating copy to clipboard operation
obsidian-git copied to clipboard

[Bug]: passphrase is missing for gpg key

Open JeremiahSecrist opened this issue 2 years ago • 13 comments

Describe the bug

Issue

when using global git configs on linux gpg fails to run properly.

  • Expected result:
    • Git repo signs files properly without extra local settings
  • Actual result:
    • Obsidian git fails to sign the files and doesnt detect changes as a result

Relevant errors (if available)

VM110:78 Uncaught (in promise) Error: error: gpg failed to sign the data
fatal: failed to write commit object

    at Object.action (eval at <anonymous> (app.js:1), <anonymous>:2120:29)
    at PluginStore.exec (eval at <anonymous> (app.js:1), <anonymous>:2155:29)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:2594:43)
    at new Promise (<anonymous>)
    at GitExecutorChain.handleTaskData (eval at <anonymous> (app.js:1), <anonymous>:2592:16)
    at GitExecutorChain.eval (eval at <anonymous> (app.js:1), <anonymous>:2576:44)
    at Generator.next (<anonymous>)
    at fulfilled (eval at <anonymous> (app.js:1), <anonymous>:2496:28)

Steps to reproduce

Steps to reproduce
  1. Have obsidian installed on linux either flatpak or appimage
  2. configure globally for git to sign files using your yubikey or other smartcard
  3. attempt to push changes to repo with obsidian git

Steps to solve temporarily

  1. Import global configs into local config
  2. attempt to backup using obsidian git
  3. watch it work properly

Expected Behavior

I am expecting it to work with global configurations.

Addition context

Relavent information

install type: flatpak (linux)
os: fedora silverblue
pgp setup: stored on yubikey
git version: 2.31.1
gpg version: 2.2.27

Git configs

Global (ommiting personal data)
[user]
        signingKey = [REDACTED]
        email = [REDACTED]
        name = arouzing
[commit]
        gpgsign = true
[init]
        defaultBranch = master
[credential]
        helper = store
[gpg]
        program = /usr/bin/gpg

Local (ommitting personal data)
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = [email protected]:[REDACTED]
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[user]
      	email = [REDACTED]
        name = arouzing

Operating system

Linux

JeremiahSecrist avatar Nov 07 '21 19:11 JeremiahSecrist

After some more tinkering It seams that It s very inconsistent when dealing with gpg on linux. even after setting the local config it seams to not work corrently. willing to do any tests needed to sort this out.

JeremiahSecrist avatar Nov 07 '21 19:11 JeremiahSecrist

I don't think this is an issue with global/local setting. Instead, the passphrase is missing to use the key.

Vinzent03 avatar Nov 28 '21 21:11 Vinzent03

I just hit this issue but in my case only flatpak installaton (of Obsidian) is affected. I tried to use official AppImage and auto / manual commit with signing works without issue.

Let me know if there is way how to help with debugging (I have zero knowledge of how flatpaks work so I am not promising to be helpful). I am fine with using AppImage until it is fixed so I am not rushing you, just sharing info. Thank you for your work.

  • OS: Fedora 36 (Kernel: x86_64 Linux 5.19.16-200.fc36.x86_64)
  • GIT: 2.38.1
  • GPG: gpg (GnuPG) 2.3.7; libgcrypt 1.10.1-unknown
  • Obsidian: 1.0.3 (both flatpak and AppImage)
  • Obsidian Git: 2.9.4
  • User details (name, email, signingkey) are defined in global .gitconfig; using local config doesn't fix this issue.

markoph avatar Nov 07 '22 19:11 markoph

It doesn't work for me on Windows either.

  • OS: Windows 10
  • GIT: 2.38.1
  • GPG: 2.3.6
  • Obsidian: 1.0.3
  • Obsidian Git: 2.13.0

When using the commandline everything works fine, I'm prompted for my ssh-passphrase and git does its thing, but Obsidian Git complains about "permission denied (publickey). fatal: could not read from remote repository."

ManInDark avatar Dec 11 '22 13:12 ManInDark

A solution for simple-git could be to add an option that is something like "Needs Passphrase" with a yes / no switch in the plugin options, and if it is set to yes then query the passphrase on startup and incorporate it like shown here (npmjs.com)

ManInDark avatar Dec 11 '22 13:12 ManInDark

Same issue on MacOS.

  • OS: MacOS 12.6.2
  • GIT: 2.37.1
  • GPG: 2.3.8
  • Obsidian: 1.1.9
  • Obsidian Git: 2.16.0

GPG settings are defined in global .gitconfig. GPG keychain is setup and works for me when setting up commits outside of obsidian git. The workaround of putting GPG settings into the local config works for me.

skullbunnygalaxy avatar Feb 09 '23 21:02 skullbunnygalaxy

Same issue on Pop! OS.

  • OS: Pop!_OS 22.04 LTS x86_64
  • Git: 2.34.1
  • GPG: gpg (GnuPG) 2.2.27 libgcrypt 1.9.4
  • Obsidian: 1.1.5
  • Obsidian Installer: 1.1.9
  • Obsidian Git: 2.16.0

Tried what @skullbunnygalaxy mentioned about adding GPG info to local config, that didn't work either.

cybersholt avatar Feb 22 '23 18:02 cybersholt

@cybersholt How did you install Obsidian? In case you re using Flatpak, try AppImage.

Vinzent03 avatar Feb 22 '23 18:02 Vinzent03

same here on mac

zerone0x avatar Apr 22 '23 16:04 zerone0x

this also seems to be happening to me.

iraizo avatar Apr 29 '23 17:04 iraizo

I use below to bypass it

git config --local commit.gpgsign false

# Read local (if never set, can be an empty value)
git config --local commit.gpgsign ```

zerone0x avatar Apr 30 '23 08:04 zerone0x

I use below to bypass it

git config --local commit.gpgsign false

# Read local (if never set, can be an empty value)
git config --local commit.gpgsign ```

does not help a lot when you actually want to authenticate with it..

iraizo avatar Apr 30 '23 09:04 iraizo

I use below to bypass it

git config --local commit.gpgsign false

# Read local (if never set, can be an empty value)
git config --local commit.gpgsign ```

does not help a lot when you actually want to authenticate with it..

Anyway, it backed up automatically now

zerone0x avatar Apr 30 '23 10:04 zerone0x