Discard changes to git-config/run.sh
parent
73f17f0d57
commit
35216c7923
@ -1,28 +1,24 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Convert templated variables to shell variables
|
||||
GIT_EMAIL=${GIT_EMAIL}
|
||||
GIT_USERNAME=${GIT_USERNAME}
|
||||
|
||||
BOLD='\033[0;1m'
|
||||
printf "$${BOLD}Checking git-config!\n\n"
|
||||
printf "$${BOLD}Checking git-config!\n"
|
||||
|
||||
# Check if git is installed
|
||||
command -v git > /dev/null 2>&1 || {
|
||||
echo "Git is not installed!"
|
||||
exit 1
|
||||
command -v git >/dev/null 2>&1 || {
|
||||
echo "Git is not installed!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Set git username and email if missing
|
||||
if [ -z "$(git config --get user.email)" ]; then
|
||||
printf "git-config: No user.email found, setting to %s\n" "$${GIT_EMAIL}"
|
||||
git config --global user.email "$${GIT_EMAIL}"
|
||||
if [ -z $(git config --get user.email) ]; then
|
||||
printf "git-config: No user.email found, setting to ${GIT_EMAIL}\n"
|
||||
git config --global user.email "${GIT_EMAIL}"
|
||||
fi
|
||||
|
||||
if [ -z "$(git config --get user.name)" ]; then
|
||||
printf "git-config: No user.name found, setting to $${GIT_USERNAME}\n\n"
|
||||
git config --global user.name "$${GIT_USERNAME}"
|
||||
if [ -z $(git config --get user.name) ]; then
|
||||
printf "git-config: No user.name found, setting to ${GIT_USERNAME}\n"
|
||||
git config --global user.name "${GIT_USERNAME}"
|
||||
fi
|
||||
|
||||
printf "$${BOLD}git-config: using email: $(git config --get user.email)\n"
|
||||
printf "\n$${BOLD}git-config: using email: $(git config --get user.email)\n"
|
||||
printf "$${BOLD}git-config: using username: $(git config --get user.name)\n\n"
|
||||
|
Loading…
Reference in New Issue