summaryrefslogtreecommitdiff
path: root/gpg-reset-pinentry
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2024-05-16 13:15:15 -0400
committerBen Sima <ben@bsima.me>2025-02-07 13:14:08 -0500
commit1bb0ee40e2ec38b035a94c382cf15b8ff2e2a65d (patch)
tree243160f7159af245b89f4a093a0e6b213b42bc82 /gpg-reset-pinentry
parentaa1fc7460c04794c088ea2cb1b9d5486473f92a8 (diff)
add gpg-reset-pinentry
Diffstat (limited to 'gpg-reset-pinentry')
-rwxr-xr-xgpg-reset-pinentry16
1 files changed, 16 insertions, 0 deletions
diff --git a/gpg-reset-pinentry b/gpg-reset-pinentry
new file mode 100755
index 0000000..4065d61
--- /dev/null
+++ b/gpg-reset-pinentry
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+#
+# If I can't use gpg-agent for ssh, then it could be because the pinentry tty is
+# locked. This can also happen if I try to sign a commit in emacs, and the
+# pinentry minibuffer get eaten by the interface. In both cases, pinentry is
+# pending, so I can't unlock the card, but I lost the pinentry and can't enter
+# my pin, so I'm totally stuck. Took me forever to figure this out but thanks to
+# SultanLegend on StackOverflow I figured it out.
+#
+# > I had the error when using gpg-agent as my ssh-agent and using a gpg subkey
+# > as my ssh key https://wiki.archlinux.org/index.php/GnuPG#gpg-agent. I
+# > suspect that the problem was caused by having an invalid pin entry tty for
+# > gpg caused by my sleep+lock command used in my sway config
+#
+# source: https://stackoverflow.com/a/57116258
+gpg-connect-agent updatestartuptty /bye > /dev/null