di-sukharev / di-sukharev/opencommit
[Bug]: Cannot enter PIN with pinentry-curses when signing commit using smart card (Yubikey) on NixOS
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 7.5k
- Forks
- 445
- Avg merge
- 18m
- Merged PRs (30d)
- 2
Description
Opencommit Version
3.2.7
Node Version
22.14.0
NPM Version
10.9.2
What OS are you seeing the problem on?
Other Linux Distro
What happened?
Hi,
I'm encountering an issue when trying to sign commits using GPG with my smart card (Yubikey) on NixOS. I'm using pinentry-curses as the pinentry program.
When pinentry-curses is invoked to ask for my PIN, the input seems broken — I can't type the PIN correctly, and the characters don't register as expected. This results in failed attempts to sign the commit.
This issue only seems to happen when using Open Commit. Signing from the terminal using git commit -S works as expected.
I'm not sure if Open Commit runs in an environment where pinentry isn't properly attached to the terminal or if there's a difference in how the input is handled.
Environment:
- Smart card: Yubikey 5
- GPG version: 2.4.7
- pinentry: pinentry-curses
OS:
- system:
"x86_64-linux" - host os:
Linux 6.12.23, NixOS, 25.05 (Warbler), 25.05.20250421.c11863f - multi-user?:
yes - sandbox:
yes - version:
nix-env (Nix) 2.28.1 - channels(root):
"nixos" - nixpkgs:
/nix/store/kcmmd6alr3lx56vkf72503h3pxgf6iv4-source
Let me know if I can provide more logs or details.
Thanks!
Expected Behavior
When I attempt to sign a commit with GPG using my smart card (Yubikey) and pinentry-curses, I expect to be able to enter my PIN without issues, just like I can when signing manually with git commit -S in the terminal. The PIN prompt should allow proper input and commit signing should succeed.
Current Behavior
When using Open Commit, pinentry-curses does launch, but I cannot type my PIN properly — keystrokes either don't register or are incorrectly processed. As a result, I'm unable to enter the correct PIN and the commit signing fails.
After writing and deleting
Possible Solution
I noticed a strange workaround: if I start typing some characters into the pinentry-curses prompt, then backspace to delete them, and only then type my actual PIN, it sometimes works and the PIN is accepted. However, during this process, the pinentry interface appears partially corrupted — parts of the prompt disappear or don’t render correctly while entering the PIN.
This suggests that the issue might be related to how the terminal input/output is handled in the environment where Open Commit launches GPG.
Steps to Reproduce
- Set up GPG with a smart card (e.g. Yubikey) and enable commit signing in Git.
- Configure GPG to use
pinentry-cursesas the pinentry program (e.g.gpgconf --change-options gpg-agent). - Use Open Commit to create and sign a commit.
- Observe the
pinentry-cursesinterface when it prompts for your PIN. - Try typing your PIN — you'll notice the input doesn't behave as expected (keystrokes missing, garbled, or non-responsive).
- Commit signing fails due to incorrect or no PIN input.
Relevant log output
◇ Confirm the commit message?
│ Yes
│
◇ ✖ Failed to generate the commit message
Error: Command failed with exit code 128: git commit -m fix(zsh.nix): rename initExtra to initContent for better naming convention
feat(zsh.nix): add support for zoxide initialization in the dotfiles shell configuration
error: gpg failed to sign the data:
[GNUPG:] KEY_CONSIDERED DB6E77D27188153E5479234630A64AF68E7E61A0 2
[GNUPG:] BEGIN_SIGNING H10
[GNUPG:] PINENTRY_LAUNCHED 21571 curses 1.3.1-unknown /dev/pts/0 xterm-kitty :0 20620/1000/3 1000/100 0
gpg: signing failed: Bad PIN
[GNUPG:] FAILURE sign 100663383
gpg: signing failed: Bad PIN
fatal: failed to write commit object
at makeError (/nix/store/lzzc952hp5d5h1b9ljlfk8gh8xcq1xil-opencommit-3.2.7/lib/node_modules/opencommit/out/cli.cjs:48250:13)
at handlePromise (/nix/store/lzzc952hp5d5h1b9ljlfk8gh8xcq1xil-opencommit-3.2.7/lib/node_modules/opencommit/out/cli.cjs:48706:29)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async generateCommitMessageFromGitDiff (/nix/store/lzzc952hp5d5h1b9ljlfk8gh8xcq1xil-opencommit-3.2.7/lib/node_modules/opencommit/out/cli.cjs:64757:26)
at async trytm (/nix/store/lzzc952hp5d5h1b9ljlfk8gh8xcq1xil-opencommit-3.2.7/lib/node_modules/opencommit/out/cli.cjs:64695:18)
at async commit (/nix/store/lzzc952hp5d5h1b9ljlfk8gh8xcq1xil-opencommit-3.2.7/lib/node_modules/opencommit/out/cli.cjs:64897:35) {
shortMessage: 'Command failed with exit code 128: git commit -m fix(zsh.nix): rename initExtra to initContent for better naming convention\n' +
'feat(zsh.nix): add support for zoxide initialization in the dotfiles shell configuration',
command: 'git commit -m fix(zsh.nix): rename initExtra to initContent for better naming convention\n' +
'feat(zsh.nix): add support for zoxide initialization in the dotfiles shell configuration',
escapedCommand: 'git commit -m "fix(zsh.nix): rename initExtra to initContent for better naming convention\n' +
'feat(zsh.nix): add support for zoxide initialization in the dotfiles shell configuration"',
exitCode: 128,
signal: undefined,
signalDescription: undefined,
stdout: '',
stderr: 'error: gpg failed to sign the data:\n' +
'[GNUPG:] KEY_CONSIDERED DB6E77D27188153E5479234630A64AF68E7E61A0 2\n' +
'[GNUPG:] BEGIN_SIGNING H10\n' +
'[GNUPG:] PINENTRY_LAUNCHED 21571 curses 1.3.1-unknown /dev/pts/0 xterm-kitty :0 20620/1000/3 1000/100 0\n' +
'gpg: signing failed: Bad PIN\n' +
'[GNUPG:] FAILURE sign 100663383\n' +
'gpg: signing failed: Bad PIN\n' +
'\n' +
'fatal: failed to write commit object',
cwd: '/home/culottes/git/dotfiles',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
│
└ ✖ Command failed with exit code 128: git commit -m fix(zsh.nix): rename initExtra to initContent for better naming convention
feat(zsh.nix): add support for zoxide initialization in the dotfiles shell configuration
error: gpg failed to sign the data:
[GNUPG:] KEY_CONSIDERED DB6E77D27188153E5479234630A64AF68E7E61A0 2
[GNUPG:] BEGIN_SIGNING H10
[GNUPG:] PINENTRY_LAUNCHED 21571 curses 1.3.1-unknown /dev/pts/0 xterm-kitty :0 20620/1000/3 1000/100 0
gpg: signing failed: Bad PIN
[GNUPG:] FAILURE sign 100663383
gpg: signing failed: Bad PIN
fatal: failed to write commit object
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with a Yubikey, GPG 2.4.7, pinentry-curses, and Open Commit, then compare it with signing via git commit -S. Trace the commit flow around commit and generateCommitMessageFromGitDiff in the reported out/cli.cjs entry point, focusing on terminal handling. Done means PIN entry works reliably and signed commits succeed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, javascript, linux, node.js
- Domain
- cli, operating-systems, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100