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}"
uot;!GPG_TTY=$(tty) git commit -S --verbose" csa = "!GPG_TTY=$(tty) git commit -S --verbose --all" csp = "!GPG_TTY=$(tty) git commit -S -pv" tag = "!GPG_TTY=$(tty) git tag -s" tty = "!export GPG_TTY=$(tty)" puv = push --verbose puff = "!git puv" pl = pull -tpf p = pull -tpf branchpull = remote update origin --prune branchremdel = push origin --delete ba = branch --list --all smam = submodule add -b master smir = submodule update --init --recursive smu = submodule foreach git pull bl = branch --list br = branch -r rhh = reset --hard HEAD sl = shortlog -s sls = "!git shortlog -s | cut -f1 | spark" gl-mr = "!sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' -" cps = cherry-pick -S [push] default = simple [pretty] ln-long = format:%C(auto)%H %gD %d %nAuthor: %aN <%aE>%n%C(auto)GPG signature: %G? %GF (%GT)%nGPG Primary Key: %GP%nDate: %ad %nSubject: %s %+b %+N %+(trailers) [core] editor = vim fileMode = true hooksPath = ~/git-hooks [merge] tool = vimdiff [mergetool] keepBackup = false [gui] fontui = -family Hack -size 11 -weight normal -slant roman -underline 0 -overstrike 0 fontdiff = -family Hack -size 11 -weight normal -slant roman -underline 0 -overstrike 0 [commit] gpgsign = false #[gpg] # program = /usr/bin/gpg2 [http] #proxy = http://10.0.0.1:3128/ [pull] rebase = false [pack] windowMemory = 1024m [credential] helper = !type pass-git-helper > /dev/null && pass-git-helper $@ useHttpPath = true