diff --git a/fish/conf.d/20-commands.fish b/fish/conf.d/20-commands.fish deleted file mode 100644 index 8a5b4d6..0000000 --- a/fish/conf.d/20-commands.fish +++ /dev/null @@ -1,2 +0,0 @@ -git config --global user.name $GITUSER -git config --global user.email $GITEMAIL diff --git a/shell/setupGit.sh b/shell/setupGit.sh new file mode 100755 index 0000000..a814f3f --- /dev/null +++ b/shell/setupGit.sh @@ -0,0 +1,34 @@ +#!/bin/sh +declare -A variables +read -p 'Git username: ' variables[gituser] +read -p 'Git email: ' variables[gitmail] + +echo "The computers git username ${variables[gituser]}" + +PS3='Which Git signing format? ' +options=("openpgp" "ssh" ) +select opt in "${options[@]}" +do + case $opt in + "openpgp") + variables[signformat]=$opt + echo Emails of currently installed secret keys: + gpg --list-secret-keys | grep uid + read -p 'Type email of secret key: ' email + variables[signingkey]=$(gpg --list-secret-keys --keyid-format=long $email | grep sec | tr " " "\n" | head -4 | tail -1 | tr "/" "\n" | head -2 | tail -1 | tr -d "\n") + break + ;; + "ssh") + variables[signformat]=$opt + read -ep 'Path to public key: ' variables[signingkey] + break + ;; + *) echo "invalid option $REPLY";; + esac +done + +git config --global user.name ${variables[gituser]} +git config --global user.email ${variables[gitmail]} +git config --global user.signingkey ${variables[sigingkey]} +git config --global gpg.format ${variables[signformat]} +git config --global commit.gpgsign true