Skip to content

Instantly share code, notes, and snippets.

@smashwilson
Last active March 14, 2017 18:44
Show Gist options
  • Save smashwilson/4420b235922581ea3d7b26769ee8ec9e to your computer and use it in GitHub Desktop.
Save smashwilson/4420b235922581ea3d7b26769ee8ec9e to your computer and use it in GitHub Desktop.
Use the GPG pinentry-mac app for SSH keys
#!/bin/sh
#
# chmod +x this script and set it as SSH_ASKPASS.
set -euo pipefail
urldecode() {
python -c 'import sys, urllib; sys.stdout.write(urllib.unquote(sys.stdin.read()))'
}
pinentry-mac <<EOM | grep '^D ' | sed -e 's/^D //g' | tr -d '\n' | urldecode
SETDESC ${1:-Please enter the passphrase for your SSH key}
GETPIN
EOM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment