Sha256: c50d22cc7df63a6351dc3c0b890a0d71bea4732e899be38c7de209be1a16a44b

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

Contents

#!/bin/bash

# This script provides one-stop shopping for entering your credentials.
# Please run this script when you reset the Docker container.
# The "git commit" command will not work without your Git credentials.

# Output:
# First argument if it is not blank
# Second argument if first argument is blank
anti_blank () {
  if [ -z "$1" ]; then
    echo "$2"
  else
    echo "$1"
  fi
}

echo '***********************'
echo 'SETTING GIT CREDENTIALS'
EMAIL_DEF='you@example.com'

echo
echo "Default email address: ${EMAIL_DEF}"
echo
echo 'Enter your Git email address:'
read EMAIL_SEL
EMAIL=$(anti_blank $EMAIL_SEL $EMAIL_DEF)
echo

echo
echo '------------------------------'
echo "git config --global user.email"
echo "$EMAIL"
git config --global user.email "$EMAIL"

NAME_DEF='Your Name'
echo
echo "Default name: ${NAME_DEF}"
echo
echo 'Enter your Git name:'
read NAME_SEL

# NOTE: The double quotes are needed to avoid truncating the string
# at the space.
NAME=$(anti_blank "$NAME_SEL" "$NAME_DEF")

echo
echo '-----------------------------'
echo "git config --global user.name"
echo "$NAME"
git config --global user.name "$NAME"
echo

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
generic_app-2.1.1 credentials.sh
generic_app-2.1.0 credentials.sh
generic_app-2.0.2 credentials.sh
generic_app-2.0.1 credentials.sh
generic_app-2.0.0 credentials.sh