Files
app-hyggecraftery/setup-github.sh
2026-01-03 15:24:36 +01:00

83 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
# Script zum Setup von GitHub Repository
echo "🚀 HyggeCraftery - GitHub Setup"
echo "==============================="
echo ""
# Prüfe ob Git bereits initialisiert ist
if [ ! -d ".git" ]; then
echo "📦 Initialisiere Git Repository..."
git init
git add .
git commit -m "Initial commit: HyggeCraftery Flutter App"
echo "✅ Git Repository initialisiert"
else
echo "✅ Git Repository bereits initialisiert"
git add .
git commit -m "Update: Deploy to Coolify" || echo "⚠️ Keine Änderungen zu committen"
fi
echo ""
echo "📋 GitHub Repository konfigurieren..."
echo ""
# Prüfe ob Remote bereits existiert
if git remote get-url origin >/dev/null 2>&1; then
CURRENT_REMOTE=$(git remote get-url origin)
echo "⚠️ Remote bereits konfiguriert: $CURRENT_REMOTE"
read -p "Möchtest du es ändern? (j/n): " CHANGE_REMOTE
if [ "$CHANGE_REMOTE" = "j" ] || [ "$CHANGE_REMOTE" = "J" ] || [ "$CHANGE_REMOTE" = "y" ] || [ "$CHANGE_REMOTE" = "Y" ]; then
git remote set-url origin https://github.com/Timborimbo/hyggecraftery_APP.git
echo "✅ Remote aktualisiert"
fi
else
git remote add origin https://github.com/Timborimbo/hyggecraftery_APP.git
echo "✅ Remote hinzugefügt"
fi
echo ""
echo "📤 Pushe zu GitHub..."
echo ""
# Branch auf main setzen (falls nicht bereits)
git branch -M main 2>/dev/null || true
# Pushen
echo " Versuche zu pushen..."
git push -u origin main
if [ $? -eq 0 ]; then
echo ""
echo "✅ Code erfolgreich zu GitHub gepusht!"
echo ""
echo "📋 Nächste Schritte in Coolify:"
echo ""
echo "1. Gehe zu deiner Application: APP_hgyyecraftery"
echo "2. Settings → Source"
echo "3. Source Type: 'Private Repository (with Deploy Key)'"
echo "4. Repository URL: https://github.com/Timborimbo/hyggecraftery_APP.git"
echo "5. Branch: main"
echo "6. Coolify wird einen Deploy Key generieren"
echo "7. Kopiere den Deploy Key und füge ihn zu GitHub hinzu:"
echo " - GitHub → Repository → Settings → Deploy keys → Add deploy key"
echo " - Füge den Key von Coolify ein"
echo "8. Speichern und Deploy!"
else
echo ""
echo "❌ Fehler beim Pushen!"
echo ""
echo "Mögliche Ursachen:"
echo " - Du bist nicht bei GitHub angemeldet"
echo " - Repository existiert noch nicht"
echo " - Keine Berechtigung"
echo ""
echo "Lösung:"
echo " 1. Prüfe, ob das Repository existiert: https://github.com/Timborimbo/hyggecraftery_APP"
echo " 2. Melde dich bei GitHub an"
echo " 3. Versuche es erneut"
exit 1
fi