33 lines
832 B
Bash
Executable File
33 lines
832 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Define the path to your repository and the Gitea repository URL
|
|
REPO_DIR="/home/doc/genesis-tools"
|
|
GITEA_REPO_URL="https://urban-squid.pikapod.net/doctator/scripts.git"
|
|
|
|
# Change to the repository directory
|
|
cd "$REPO_DIR"
|
|
|
|
# Initialize git if not already done
|
|
if [ ! -d ".git" ]; then
|
|
echo "Initializing a new git repository..."
|
|
git init
|
|
git remote add origin "$GITEA_REPO_URL"
|
|
else
|
|
echo "Git repository already initialized..."
|
|
fi
|
|
|
|
# Check if there are any changes or untracked files
|
|
if ! git diff-index --quiet HEAD --; then
|
|
# Stage all changes
|
|
git add .
|
|
|
|
# Commit changes
|
|
git commit -m "Auto commit from /home/doc/genesis-tools"
|
|
|
|
# Push changes to Gitea repository
|
|
git push origin master # Or 'main' if that's the branch name
|
|
else
|
|
echo "No changes to commit."
|
|
fi
|