diff --git a/sync-to-server.sh b/sync-to-server.sh index 483eee1..1a236f1 100755 --- a/sync-to-server.sh +++ b/sync-to-server.sh @@ -23,23 +23,25 @@ git push origin main # Update the variables below with your VPS credentials SERVER_USER="root" SERVER_IP="194.163.173.157" # Contabo VPS -PROJECT_DIR="/home/intaleqapp-musadeq/htdocs" +PROJECT_DIR="/home/intaleqapp-musadeq/htdocs/musadeq.intaleqapp.com" echo "🌐 Synchronizing with production server ($SERVER_IP)..." ssh $SERVER_USER@$SERVER_IP << EOF - git config --global --add safe.directory $PROJECT_DIR - mkdir -p $PROJECT_DIR cd $PROJECT_DIR + git config --global --add safe.directory $PROJECT_DIR if [ ! -d ".git" ]; then echo "🌑 Initializing production repository (Force setup in non-empty dir)..." git init + git config --global --add safe.directory $PROJECT_DIR git remote add origin https://git.intaleqapp.com/Hamza/musadeq.git git fetch --all git reset --hard origin/main else echo "⬇️ Pulling latest changes from Git..." + # In case remote was lost or ownership changed + git remote add origin https://git.intaleqapp.com/Hamza/musadeq.git 2>/dev/null git pull origin main fi