2022-07-04 17:07:17 +03:00
|
|
|
#!/bin/sh
|
2023-02-05 12:53:53 +03:00
|
|
|
set -e
|
2022-07-04 17:07:17 +03:00
|
|
|
|
2022-08-09 11:27:28 +03:00
|
|
|
echo "Setting up git"
|
2022-07-04 17:07:17 +03:00
|
|
|
read -p "Enter your name for commits: " GITNAME
|
|
|
|
git config --global user.name "$GITNAME"
|
|
|
|
read -p "Enter your email for commits: " GITEMAIL
|
|
|
|
git config --global user.email "$GITEMAIL"
|
|
|
|
read -p "Configure GPG signing for git? (y/N): " answer
|
|
|
|
|
|
|
|
if [[ $answer = [Yy] ]]; then
|
|
|
|
git config --global commit.gpgsign true
|
2023-01-04 12:07:16 +03:00
|
|
|
git config --global gpg.program gpg
|
2022-07-04 17:07:17 +03:00
|
|
|
read -p "Enter your GPG key ID: " GPGKEYID
|
|
|
|
git config --global user.signingkey "${GPGKEYID}"
|
|
|
|
else
|
|
|
|
git config --global commit.gpgsign false
|
|
|
|
fi
|
|
|
|
|
|
|
|
# configure git for merge
|
|
|
|
git config --global pull.rebase false
|
|
|
|
read -p "Enter your preferred editor (default: nvim): " GITEDITOR
|
|
|
|
|
2023-01-04 12:06:55 +03:00
|
|
|
if [ $GITEDITOR == "" ]
|
2022-07-04 17:07:17 +03:00
|
|
|
then
|
|
|
|
GITEDITOR="nvim"
|
|
|
|
fi
|
|
|
|
git config --global core.editor $GITEDITOR
|
|
|
|
|
2022-08-09 11:27:28 +03:00
|
|
|
echo "\nGit configured with:"
|
|
|
|
echo "user.name: $GITNAME"
|
|
|
|
echo "user.email: $GITEMAIL"
|
|
|
|
echo "core.editor: $GITEDITOR"
|
|
|
|
echo "pull.rebase: false (merge)"
|
2022-07-04 17:33:43 +03:00
|
|
|
|
2022-07-04 17:07:17 +03:00
|
|
|
if [[ $answer = [Yy] ]]
|
|
|
|
then
|
2022-08-09 11:27:28 +03:00
|
|
|
echo "commit.codesign: true"
|
|
|
|
echo "gpg.program: gpg2"
|
|
|
|
echo "user.signingkey: $GPGKEYID"
|
2022-07-04 17:07:17 +03:00
|
|
|
else
|
2022-08-09 11:27:28 +03:00
|
|
|
echo "commit.codesign: false"
|
|
|
|
fi
|