Update git_commit
This commit is contained in:
parent
c9505e1bdd
commit
db8946f28e
24
git_commit
24
git_commit
@ -1,20 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# bash <(curl -s https://git.technozone.com.au/vijay/Scripts/branch/main/git_commit) && rm -f git_commit
|
# bash <(curl -s https://git.technozone.com.au/vijay/Scripts/raw/branch/main/git_commit) && rm -f git_commit
|
||||||
|
|
||||||
# Prompt for the Gitea repository URL
|
# Prompt for the Gitea repository URL
|
||||||
read -p "Enter your Gitea repository URL: " GITEA_URL
|
read -p "Enter your Gitea repository URL: " GITEA_URL
|
||||||
|
|
||||||
# Function to prompt for username and password
|
# Function to prompt for the access token
|
||||||
prompt_for_credentials() {
|
prompt_for_token() {
|
||||||
read -p "Enter your Gitea username: " username
|
read -sp "Enter your Gitea access token: " GIT_TOKEN
|
||||||
read -sp "Enter your Gitea password: " password
|
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for existing Git credentials (token)
|
# Check for existing Git token
|
||||||
if [ -z "$GIT_TOKEN" ]; then
|
if [ -z "$GIT_TOKEN" ]; then
|
||||||
echo "No Git token found."
|
echo "No Git token found."
|
||||||
prompt_for_credentials
|
prompt_for_token
|
||||||
else
|
else
|
||||||
echo "Using existing Git token."
|
echo "Using existing Git token."
|
||||||
fi
|
fi
|
||||||
@ -41,13 +40,8 @@ git add .
|
|||||||
read -p "Enter your commit message: " commit_message
|
read -p "Enter your commit message: " commit_message
|
||||||
git commit -m "$commit_message"
|
git commit -m "$commit_message"
|
||||||
|
|
||||||
# Push changes
|
# Push changes using the access token
|
||||||
if [ -z "$GIT_TOKEN" ]; then
|
echo "Pushing changes using access token..."
|
||||||
echo "Pushing changes using username and password..."
|
git push "https://$GIT_TOKEN@${GITEA_URL#https://}"
|
||||||
git push "https://$username:$password@$GITEA_URL"
|
|
||||||
else
|
|
||||||
echo "Pushing changes using token..."
|
|
||||||
git push "$GITEA_URL"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Changes pushed successfully."
|
echo "Changes pushed successfully."
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user