My workaround will results in a terminal command that will ask for your GPG password, it'll not be a working popup from pinentry.
I did this because I was having this error with pinentry:
# I'm running Manjaro KDE 21.3.5
$ echo GETPIN | pinentry
OK Pleased to meet you
S ERROR curses.isatty 83918950
ERR 83918950 Inappropriate ioctl for device <Pinentry>
I'll assume that if you got to this point, you've already created your GPG key and know something about the gnupg and git config files.
Here's what I've in my configs:
# .zshrc, .bashrc...
export GPG_TTY=$(tty)
# gpg-agent.conf
pinentry-program /usr/bin/pinentry-curses
max-cache-ttl 60480000
default-cache-ttl 60480000
# gpg.conf
use-agent
pinentry-mode loopback
default-key XXXXXXXXXXXXXXXX
# .gitconfig
[user]
name = xxx
email = xxx
signingkey = XXXXXXXXXXXXXXXX
[gpg]
program = gpg2
[commit]
gpgsign = true
Solution
We are going to create a script to be call by an alias:
# .zshrc, .bashrc...
alias unlock_gpg="~/.unlock_gpg.sh"
# ~/.unlock_gpg.sh <- create this file and add the script below
current_dir=$(pwd)
cd ~/.unlock_gpg
git add .
git commit -m "abc"
git reset --soft HEAD~1
cd $current_dir
# Run this command:
$ chmod +x ~/.unlock_gpg.sh
Now create a folder with a git repo following the steps below:
$ mkdir ~/.unlock_gpg/
$ cd ~/.unlock_gpg/
$ git init
$ touch file.txt
$ git add .
$ git commit -m "first commit"
# if gpg ask for your password, provide it
$ echo 'hi' > file.txt
# This will reset your gpg agent, so you can test it below.
$ gpgconf --reload gpg-agent
Now try it out:
$ unlock_gpg
# Now you should see a password prompt like this:
Enter passphrase:
# Just enter your password and sign your commits as you wish
If you have a better/definitive solution please comment.
Top comments (0)