in .bashrc or .profile
export GPG_TTY=$(tty)
if [[ -n "$SSH_CONNECTION" ]] ;then
export PINENTRY_USER_DATA="USE_CURSES=1"
fiSource https://gpgtools.tenderapp.com/kb/faq/enter-passphrase-with-pinentry-in-terminal-via-ssh-connection
# no curses, only tty
echo "pinentry-program /home/alex/.nix-profile/bin/pinentry-tty" > $HOME/.gnupg/gpg-agent.conf
gpg-connect-agent reloadagent /bye