Files
igny8/push-to-gitea.sh

56 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# Script to push igny8 repository to Gitea
set -e
REPO_NAME="igny8"
GITEA_URL="http://git.igny8.com"
echo "🚀 Pushing igny8 repository to Gitea..."
echo ""
# Check if remote exists
if git remote get-url origin >/dev/null 2>&1; then
echo "✅ Remote 'origin' already configured"
git remote -v
else
echo "📝 Adding remote origin..."
# Try different URL formats
git remote add origin "${GITEA_URL}/${REPO_NAME}/${REPO_NAME}.git" 2>/dev/null || \
git remote add origin "${GITEA_URL}/root/${REPO_NAME}.git" 2>/dev/null || \
git remote add origin "${GITEA_URL}/admin/${REPO_NAME}.git" 2>/dev/null || \
echo "⚠️ Could not determine correct URL format"
fi
echo ""
echo "📤 Pushing to Gitea..."
echo ""
# Try to push
if git push -u origin main 2>&1; then
echo ""
echo "✅ Successfully pushed to Gitea!"
echo "📍 Repository URL: ${GITEA_URL}/${REPO_NAME}/${REPO_NAME}"
else
echo ""
echo "❌ Push failed. This usually means:"
echo " 1. The repository doesn't exist yet in Gitea"
echo " 2. Authentication is required"
echo ""
echo "📋 To create the repository:"
echo " 1. Visit ${GITEA_URL}"
echo " 2. Sign in or create an account"
echo " 3. Click '+' → 'New Repository'"
echo " 4. Name it '${REPO_NAME}' and create it"
echo " 5. Then run this script again: ./push-to-gitea.sh"
echo ""
echo "💡 Or create it via API with a token:"
echo " curl -X POST '${GITEA_URL}/api/v1/user/repos' \\"
echo " -H 'Authorization: token YOUR_TOKEN' \\"
echo " -H 'Content-Type: application/json' \\"
echo " -d '{\"name\":\"${REPO_NAME}\",\"private\":false}'"
exit 1
fi