mirror of
https://github.com/ivabus/dotfiles
synced 2024-11-10 02:05:16 +03:00
Add git configurator
This commit is contained in:
parent
0d8efb170d
commit
64fffd21bc
44
tools/git.sh
Normal file
44
tools/git.sh
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
GREEN="\033[32m"
|
||||||
|
RED="\033[31m"
|
||||||
|
DEFAULTC="\033[0m"
|
||||||
|
|
||||||
|
echo "${GREEN}Setting up git$DEFAULTC"
|
||||||
|
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
|
||||||
|
git config --global gpg.program gpg2
|
||||||
|
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
|
||||||
|
|
||||||
|
if [ $GITEDITOR = ""]
|
||||||
|
then
|
||||||
|
GITEDITOR="nvim"
|
||||||
|
fi
|
||||||
|
git config --global core.editor $GITEDITOR
|
||||||
|
|
||||||
|
echo "\n${RED}Git configured with:$DEFAULTC"
|
||||||
|
echo "${GREEN}user.name: ${DEFAULTC}$GITNAME"
|
||||||
|
echo "${GREEN}user.email: ${DEFAULTC}$GITEMAIL"
|
||||||
|
echo "${GREEN}core.editor: ${DEFAULTC}$GITEDITOR"
|
||||||
|
if [[ $answer = [Yy] ]]
|
||||||
|
then
|
||||||
|
echo "${GREEN}commit.codesign: ${DEFAULTC}true"
|
||||||
|
echo "${GREEN}gpg.program: ${DEFAULTC}gpg2"
|
||||||
|
echo "${GREEN}user.signingkey: ${DEFAULTC}$GPGKEYID"
|
||||||
|
else
|
||||||
|
echo "${GREEN}commit.codesign: ${DEFAULTC}false"
|
||||||
|
fi
|
|
@ -33,3 +33,7 @@ sh $HOME/.dotfiles/tools/relink.sh
|
||||||
cd $CURRENTDIR
|
cd $CURRENTDIR
|
||||||
|
|
||||||
echo "${GREEN}Dotfiles installed and linked.$DEFAULTC"
|
echo "${GREEN}Dotfiles installed and linked.$DEFAULTC"
|
||||||
|
read -p "Would you like to configure git? (y/N): " answer
|
||||||
|
if [[ $answer = [Yy] ]]; then
|
||||||
|
sh tools/git.sh
|
||||||
|
fi
|
Loading…
Reference in a new issue