Git sign in pkgs.vscode


I am using the “vscode” package via home manager on my NixOS laptop. I config my vs code with the settings sync option, so I do not want home manager to interfere with anything. As of now everything works great except the git commit button in the git tab. I get this error about signing even though git commit -S (and the full command vscode run) works well in the terminal.

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file - -S
error: gpg failed to sign the data:
gpg: keyblock resource '/home/guibi/nix-config/$XDG_DATA_HOME/gnupg/pubring.kbx': No such file or directory
[GNUPG:] ERROR add_keyblock_resource 33587281
[GNUPG:] ERROR keydb_search 33554445
gpg: skipped "****mykey****": No secret key
[GNUPG:] INV_SGNR 9 ****mykey*****
[GNUPG:] FAILURE sign 17
gpg: signing failed: No secret key

fatal: failed to write commit object


Is it pinentry related? Do you have yours configured to be cached after unlock? Does it work in VSCode after running it in terminal and getting it cached up?

Im not sure about pinentry? My gpg key is unprotected (password-wise) and it never works in vscode, even after I use the terminal.
I was assuming that the git that vscode uses doesn’t use the same gpg that i do? Is that even a thing?

This certainly looks odd, but I don’t know what to advise, especially if its not pinentry related (since you don’t need it), and if your config works from terminal:

gpg: keyblock resource '/home/guibi/nix-config/$XDG_DATA_HOME/gnupg/pubring.kbx': No such file or directory.

If i try to cat '/home/guibi/nix-config/$XDG_DATA_HOME/gnupg/pubring.kbx' it gives me an error… Maybe it’s that?