#!/bin/bash # 🚀 NETGESCON - SETUP REPOSITORY GIT COMPLETO # Creato: 19/07/2025 - Setup Git Distribuito Michele + AI set -e echo "🚀 === NETGESCON - SETUP REPOSITORY GIT COMPLETO ===" echo "📅 $(date '+%Y-%m-%d %H:%M:%S')" echo "" # === CONFIGURAZIONI === REPO_NAME="netgescon-main" REMOTE_SERVER="192.168.1.100" # Sostituisci con IP del server master REMOTE_USER="michele" GIT_BRANCH="master" echo "📋 Configurazione:" echo " Repository: $REPO_NAME" echo " Server: $REMOTE_SERVER" echo " Branch: $GIT_BRANCH" echo "" # === 1. CONFIGURAZIONE GIT LOCALE === echo "🔧 1. Configurazione Git locale..." if ! git config user.name >/dev/null 2>&1; then git config user.name "Michele NetGescon" git config user.email "michele@netgescon.local" echo " ✅ Configurato utente Git" else echo " ✅ Utente Git già configurato: $(git config user.name)" fi # === 2. COMMIT INIZIALE === echo "" echo "📦 2. Creazione commit iniziale..." git add . git commit -m "🎯 NETGESCON - Setup iniziale repository completo 📋 Commit iniziale con: - ✅ Documentazione unificata in docs/ - ✅ Codice Laravel in netgescon-laravel/ - ✅ Script automazione in scripts/ - ✅ Configurazione sync rsync - ✅ Struttura organizzata e pulita 🔄 Versione: $(date '+%Y.%m.%d-%H%M') 🎯 Sistema pronto per Git distribuito" echo " ✅ Commit iniziale creato" # === 3. CREAZIONE BRANCHES === echo "" echo "🌿 3. Creazione branches strategici..." # Branch development git checkout -b development git checkout master echo " ✅ Branch 'development' creato" # Branch release git checkout -b release git checkout master echo " ✅ Branch 'release' creato" # Branch hotfix git checkout -b hotfix git checkout master echo " ✅ Branch 'hotfix' creato" # === 4. PREPARAZIONE REMOTE (SE SPECIFICATO) === if [ "$REMOTE_SERVER" != "192.168.1.100" ]; then echo "" echo "🌐 4. Configurazione remote server..." # Aggiungi remote origin git remote add origin "ssh://$REMOTE_USER@$REMOTE_SERVER/var/git/$REPO_NAME.git" echo " ✅ Remote origin configurato" echo "" echo "🚀 Push al server remoto..." echo " NOTA: Assicurati che il server Git sia configurato!" echo " Comando: git push -u origin master" else echo "" echo "⚠️ 4. Remote server non configurato (IP di esempio)" echo " Per configurare il remote:" echo " git remote add origin ssh://user@SERVER-IP/var/git/$REPO_NAME.git" fi # === 5. RIEPILOGO === echo "" echo "📊 === RIEPILOGO SETUP GIT ===" echo "✅ Repository inizializzato: $REPO_NAME" echo "✅ Commit iniziale creato" echo "✅ Branches creati: master, development, release, hotfix" echo "✅ .gitignore configurato" echo "" echo "🔄 Branches disponibili:" git branch -a echo "" echo "📋 Prossimi passi:" echo "1. 🔧 Configurare Git server (Gitea/GitLab) su server master" echo "2. 🌐 Aggiornare REMOTE_SERVER in questo script" echo "3. 🚀 Eseguire primo push: git push -u origin master" echo "4. 📦 Configurare workflow CI/CD" echo "" echo "🎯 Setup Git completato con successo!" echo "📅 $(date '+%Y-%m-%d %H:%M:%S')"