This commit is contained in:
LukeGus
2024-11-28 01:34:32 +00:00
parent 06a0884cff
commit 80c49d1510

View File

@@ -10,6 +10,9 @@ fi
COMMIT_MESSAGE=$1 COMMIT_MESSAGE=$1
BRANCH_NAME=$2 BRANCH_NAME=$2
# Ensure Git is using the credential helper for HTTPS
git config --global credential.helper store
# Check if the branch exists # Check if the branch exists
BRANCH_EXISTS=$(git branch --list "$BRANCH_NAME") BRANCH_EXISTS=$(git branch --list "$BRANCH_NAME")
@@ -51,6 +54,8 @@ if [ $? -ne 0 ]; then
fi fi
echo "Pushing changes forcefully to branch: $BRANCH_NAME" 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" git push -f origin "$BRANCH_NAME"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Push failed." echo "Push failed."