diff --git a/setup/homelapGitSetup.sh b/setup/homelapGitSetup.sh index 49a56c8..73270db 100755 --- a/setup/homelapGitSetup.sh +++ b/setup/homelapGitSetup.sh @@ -40,17 +40,18 @@ gitUserSetup() { git config --global user.email "$g_mail" git config --global init.defaultBranch "$g_branch" - echo_note "Enter your authentication token:" - read -r -s g_token # The '-s' flag hides input for privacy + if ! -e "$CREDENTIALS_FILE"; then + echo_note "Enter your authentication token:" + read -r -s g_token # The '-s' flag hides input for privacy + # Append the new credentials to the file + echo "https://$g_username:$g_token@$g_domain" >>"$CREDENTIALS_FILE" - # Append the new credentials to the file - echo "https://$g_username:$g_token@$g_domain" >>"$CREDENTIALS_FILE" + echo "Credentials added for $g_domain in $CREDENTIALS_FILE" - echo "Credentials added for $g_domain in $CREDENTIALS_FILE" + git config --global credential.helper store - git config --global credential.helper store - - chmod 600 "$HOME/.git-credentials" + chmod 600 "$HOME/.git-credentials" + fi } gitDirSetup() {