Skip to content

Instantly share code, notes, and snippets.

@dtaylor84
dtaylor84 / gpg-agent-forward.sh
Last active May 15, 2017 07:10
Cygwin GPG Agent Forwarding Script (for use with Gpg4Win 3, requires openssh and ssh-pageant)
#!/bin/bash -e
remote="$1@$2"
echo -ne '\e]0;wait... '"$remote"'\a'
eval $(/usr/bin/ssh-pageant -r -a "/tmp/.ssh-pageant-$USERNAME")
localdir="$(cygpath -u "$APPDATA")/gnupg"
extrasock="$localdir/S.gpg-agent.extra" # file containing "PORT\nNONCE"
rdir='$HOME/.gnupg' # remote prefix
rinsock="$rdir/S.gpg-agent" # listen on this socket on server