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