#!/bin/bash set -e # Log timestamp echo "=== Git Sync at $(date -u) ===" # 1. Đồng bộ tự động cho OpenMAIC (code + container + submodule) if [ -f /opt/ai-os/products/ceo/projects/tech/OpenMAIC/git_sync.sh ]; then /bin/bash /opt/ai-os/products/ceo/projects/tech/OpenMAIC/git_sync.sh || true fi # 2. Đồng bộ tự động cho repo mẹ ceo-ai-os cd /opt/ai-os/products/ceo # Luôn commit local changes trước để tránh lỗi 'cannot pull with rebase: You have unstaged changes' if [ -n "$(git status --porcelain)" ]; then echo "Changes detected in ceo-ai-os, staging and committing..." git add -A git commit -m "chore: auto-sync from VPS Hermes [HM]" || true fi echo "Pulling from origin main in ceo-ai-os..." git pull --rebase origin main || true echo "Pushing to origin main in ceo-ai-os..." git push origin main || true echo "Sync completed successfully."