X-Git-Url: https://git.josue.xyz/?p=webi-installers%2F.git;a=blobdiff_plain;f=git-config-gpg%2Fgit-config-gpg.sh;fp=git-config-gpg%2Fgit-config-gpg.sh;h=324bd000a8521da74a917306f3e6744f0427853b;hp=3b38745bb01c789085887e7c6f111cc20241d1d6;hb=ca7a838c6fde6052124947ff442aa9e6056f5e28;hpb=704265583cff80363fec60c4088f5b91f6d98bd0 diff --git a/git-config-gpg/git-config-gpg.sh b/git-config-gpg/git-config-gpg.sh index 3b38745..324bd00 100644 --- a/git-config-gpg/git-config-gpg.sh +++ b/git-config-gpg/git-config-gpg.sh @@ -2,35 +2,39 @@ set -e set -u -export PATH="$HOME/.local/opt/gnupg/bin:$PATH" -export PATH="$HOME/.local/opt/gnupg/bin/pinentry-mac.app/Contents/MacOS:$PATH" +function __git_gpg_init() { + export PATH="$HOME/.local/opt/gnupg/bin:$PATH" + export PATH="$HOME/.local/opt/gnupg/bin/pinentry-mac.app/Contents/MacOS:$PATH" -# TODO check for public key without gpg-pubkey? -if ! command -v gpg-pubkey; then - webi gpg-pubkey -else - gpg-pubkey -fi + # TODO check for public key without gpg-pubkey? + if ! command -v gpg-pubkey; then + webi gpg-pubkey + else + gpg-pubkey + fi -MY_KEY_ID="$( - gpg-pubkey-id -)" + MY_KEY_ID="$( + gpg-pubkey-id + )" -echo -n "Enabling automatic git commit signing... - git config --global user.signingkey ${MY_KEY_ID} + echo -n "Enabling automatic git commit signing... + git config --global user.signingkey ${MY_KEY_ID} + git config --global commit.gpgsign true + git config --global log.showSignature true + " + + git config --global user.signingkey "${MY_KEY_ID}" git config --global commit.gpgsign true git config --global log.showSignature true -" -git config --global user.signingkey "${MY_KEY_ID}" -git config --global commit.gpgsign true -git config --global log.showSignature true + echo "" + echo "Successfully updated ~/.gitconfig" + echo "" + echo "How to verify signed commits on GitHub:" + echo "" + echo " 1. Go to 'Add GPG Key': https://github.com/settings/gpg/new" + echo " 2. Copy and paste the key above from the first ---- to the last ----" + echo "" +} -echo "" -echo "Successfully updated ~/.gitconfig" -echo "" -echo "How to verify signed commits on GitHub:" -echo "" -echo " 1. Go to 'Add GPG Key': https://github.com/settings/gpg/new" -echo " 2. Copy and paste the key above from the first ---- to the last ----" -echo "" +__git_gpg_init