2023-05-18 18:40:35 -04:00

27 lines
656 B
Bash
Executable File

#!/usr/bin/env bash
if [[ -z "$1" ]]; then
project="$(basename $(pwd))"
else
project="$1"
shift
fi
token="$(pass show gitea/token/${project})"
if [[ -z "$token" ]]; then
printf 'Failed to get token for %s. ' "$project" >&2
printf 'Must be one of:\n\n' >&2
pass show gitea/token >&2
exit 1
fi
gpg_key='75D6600BEF4E8E8F'
url="https://luke:${token}@git.drheck.dev/luke/${project}.git"
if [[ "$project" == 'pass' ]]; then
pass git config user.signingkey "$gpg_key"!
pass git config commit.gpgsign true
pass git pull "$url"
else
git config user.signingkey "$gpg_key"!
git config commit.gpgsign true
GPG_TTY=$(tty) git pull "$url"
fi