Skip to content

Instantly share code, notes, and snippets.

@maple3142
Created February 28, 2025 03:46
Show Gist options
  • Save maple3142/ebe3760cc2508aa0155ffac654062468 to your computer and use it in GitHub Desktop.
Save maple3142/ebe3760cc2508aa0155ffac654062468 to your computer and use it in GitHub Desktop.
vscode git signing & gpg tty pinentry

A workaround for people who prefer entering password in tty when possible (e.g. using pinentry-mode loopback) but don't want to break vscode commit signing:

  1. Create a ~/.local/bin/my-pinentry.sh:
#!/bin/sh
if [ "$PINENTRY_USER_DATA" = "tty" ]; then
    exec /usr/bin/pinentry-tty "$@"
else
    exec /usr/bin/pinentry "$@"
fi
  1. chmod +x ~/.local/bin/my-pinentry.sh
  2. Ensure the following line exist in your ~/.gnupg/gpg-agent.conf:
pinentry-program /home/YOUR_USERNAME/.local/bin/my-pinentry.sh
  1. Put export PINENTRY_USER_DATA=tty in your .zshrc or .bashrc (or others depends on your shell)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment