27 lines
719 B
Bash
Executable File
27 lines
719 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# ============================================
|
|
# Script auto-sincronizare Git Repo
|
|
# ============================================
|
|
|
|
# Configurații
|
|
REPO_URL="https://gitea.dev.bodnarescu.ro/marius/first_gitea.git" # Sau HTTPS
|
|
LOCAL_DIR="$HOME/first_gitea"
|
|
COMMIT_MSG="Auto update on $(date '+%Y-%m-%d %H:%M:%S')"
|
|
|
|
# Verifică dacă folderul există
|
|
if [ ! -d "$LOCAL_DIR/.git" ]; then
|
|
echo "Repo nu există local. Se clonează..."
|
|
git clone "$REPO_URL" "$LOCAL_DIR" || { echo "Clonarea a eșuat"; exit 1; }
|
|
fi
|
|
|
|
# Mergem în repo
|
|
cd "$LOCAL_DIR" || { echo "Folderul nu există"; exit 1; }
|
|
|
|
# Git add/commit/push
|
|
git add .
|
|
git commit -m "$COMMIT_MSG"
|
|
git push
|
|
|
|
echo "✅ Repo sincronizat cu succes."
|