Adaugare script auto-sincronizare Git
This commit is contained in:
26
git_sync.sh
Normal file
26
git_sync.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ============================================
|
||||
# Script auto-sincronizare Git
|
||||
# ============================================
|
||||
|
||||
# Configurații
|
||||
REPO_URL="git@github.com:user/nume-repo.git" # Sau HTTPS
|
||||
LOCAL_DIR="$HOME/proiect"
|
||||
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."
|
||||
Reference in New Issue
Block a user