diff --git a/git_push.sh b/git_push.sh index 891812bf..00184f6b 100755 --- a/git_push.sh +++ b/git_push.sh @@ -10,6 +10,9 @@ fi COMMIT_MESSAGE=$1 BRANCH_NAME=$2 +# Ensure Git is using the credential helper for HTTPS +git config --global credential.helper store + # Check if the branch exists BRANCH_EXISTS=$(git branch --list "$BRANCH_NAME") @@ -51,6 +54,8 @@ if [ $? -ne 0 ]; then fi echo "Pushing changes forcefully to branch: $BRANCH_NAME" +# Set GIT_ASKPASS to bypass the password prompt using the stored credentials +export GIT_ASKPASS=echo git push -f origin "$BRANCH_NAME" if [ $? -ne 0 ]; then echo "Push failed."