git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/bin/ssh-with-gpg
blob: 7ca0d67c36f4b2687e1771d9b8997974e876cfba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash

# For this to work, you also need to import the public key of any private key you want to use
# in the target server's pubring first.

if [ -z "$1" ];then
	printf "USAGE: %b TARGET [OPTIONS...]\\n" "$(basename "$0")" >&2
	exit 1
fi

TGT="$1"

REMUID="$(ssh "$TGT" "id -u")"
ssh "$TGT" 'killall gpg-agent 2>/dev/null;rm -f /run/user/$(id -u)/gnupg/S.*'
if [ -z "$REMUID" ];then
	printf "Cannot fetch user id from %b.\\n" "$TGT" >&2
	exit 2
fi

ssh -R "/run/user/${REMUID}/gnupg/S.gpg-agent":"/run/user/$(id -u)/gnupg/S.gpg-agent-extra" -o "StreamLocalBindUnlink=yes" "$TGT" "${@:2}"
H. P. 2024-07-141-1/+1 * | preparation for submodule-less checkoutH. P. 2024-07-143-12/+23 * | +pre-commitH. P. 2024-07-141-0/+4 * | add git-prompt to ignore listH. P. 2024-07-141-1/+1 * | remove from cacheH. P. 2024-07-141-0/+0 * | move submodule git-prompt to post-checkoutH. P. 2024-07-144-6/+14 * | ...H. P. 2024-07-141-1/+1 * | here goes another attemptH. P. 2024-07-142-1/+29 * | specify branch of submoduleH. P. 2024-07-141-0/+1 * | Merge between two machines (again)H. P. 2024-07-141-6/+11 |\ \ | * \ Merge between two pulls and machinesH. P. 2024-07-142-0/+3 | |\ \ | * | | +weird sha1collisiondetection submodule in READMEH. P. 2024-07-141-6/+11 * | | | reintroducing main submodule shllow/sparse configH. P. 2024-07-141-0/+2 | |/ / |/| | * | | working commit for submoduleH. P. 2024-07-142-0/+3 |/ / * | revampH. P. 2024-07-142-5/+0 * | fix: submodule info of git-prompt was garbageH. P. 2024-07-141-1/+3 * | inclusion of git promptH. P. 2024-07-145-1/+24 * | integrate go binaries in $HOME into PATHH. P. 2024-07-141-1/+1 * | Updated submodulesH. P. 2024-05-262-0/+0 * | + flake8's cognitive complexityH. P. 2024-05-261-0/+2 * | include tofu in gpg trust modelH. P. 2024-05-251-0/+1 * | fwiw, return to whitespaces. more bytes, but more interoperability.H. P. 2024-05-251-1/+1 * | only use the control master if desired. causes more fuss than solutions on da...H. P. 2024-05-251-2/+2 * | + credential helper, + memory windowH. P. 2024-05-251-0/+6 |/ * more git aliasesv1.1.0H. P. 2024-05-251-0/+8