Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue committing with locked signing key #1836

Closed
danjones1618 opened this issue Sep 13, 2021 · 8 comments
Closed

Issue committing with locked signing key #1836

danjones1618 opened this issue Sep 13, 2021 · 8 comments

Comments

@danjones1618
Copy link

I currently have my pinentry program set to pinentry-curses for unlocking my signing key

When using fugitive to :G commit when the key is locked it will start pinentry-curses to request the signing key password.
However, when this happens it renders over vim and upon exiting vim is looks messed up as the background of pinentry-curses is still present. This can be reset by doing ! to re-render vim

Is there any way around this?

@tpope
Copy link
Owner

tpope commented Sep 13, 2021

I would expect this not to work: The interaction model of :Git necessitates the use of a dumb terminal, which is pinentry-tty territory, not pinentry-curses. But it sounds like what is happening is that pinentry-curses is getting its hands on Vim's tty and trashing it.

What Vim version? What OS? What is :echo g:fugitive_pty (expected to be an undefined variable)?

@danjones1618
Copy link
Author

That explanation makes perfect sense.
If it's not possible then I'll just switch to pinentry-tty

Version: VIM 8.2 (from arch repos)
OS: Arch Linux
:echo g:fugitive_pty: Undefined variable

@tpope
Copy link
Owner

tpope commented Sep 13, 2021

Can you tell me if you have $GPG_TTY set or are doing anything else similarly nefarious?

@danjones1618
Copy link
Author

Just export GPG_TTY=$(tty)

@tpope
Copy link
Owner

tpope commented Sep 13, 2021

Well that would certainly explain it. You're telling GPG to hijack the current TTY away from Vim, so it's no surprise that the screen gets garbled without Vim knowing about it. I think I'll fix it by blanking out GPG_TTY when calling git.

@danjones1618
Copy link
Author

That makes sense. Iirc the rational behind it is to do with ssh-ing into the machine
Thanks!

@tpope
Copy link
Owner

tpope commented Sep 14, 2021

I found a workaround, but it's not pretty. Put this in /usr/local/bin/gpg or anywhere else that outranks /usr/bin in $PATH:

#!/bin/sh

if [ -n "$FUGITIVE" ]; then
  set -- --pinentry-mode loopback "$@"
fi
exec /usr/bin/gpg "$@"

Alternatively, give the script a different name, and configure gpg.program in Git to point at it.

@tpope tpope closed this as completed in 5be8263 Sep 14, 2021
@danjones1618
Copy link
Author

That worked thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants