diff --git a/.config/git/config b/.config/git/config index 2d8d52d..e8d21e7 100644 --- a/.config/git/config +++ b/.config/git/config @@ -3,7 +3,10 @@ name = stupidcomputer [credential "https://git.beepboop.systems"] - username = stupidcomputer + helper = !git-rbw-wrap gitea + +[credential "https://github.com"] + helper = !git-rbw-wrap github-pat [advice] addIgnoredFile = false diff --git a/builds/utils/git-rbw-wrap b/builds/utils/git-rbw-wrap new file mode 100755 index 0000000..1af7ead --- /dev/null +++ b/builds/utils/git-rbw-wrap @@ -0,0 +1,16 @@ +#!/bin/sh + +[ -z "$1" ] && exit 1 + +# wrap rbw get $1 --full to output in the git credential helper +# format + +# username=yourusername +# password=yourpassword + +output=$(rbw get $1 --full) +echo "$output" | \ + sed '1{s/^/password=/}' | \ + sed 's/Username: /username=/g' | \ + grep -E 'username|password' | \ + tac