#!/bin/bash # Script to connect this workspace to your existing GitHub repository echo "🔗 Connecting workspace to GitHub repository..." echo "=================================================" # Check if repository name is provided if [ -z "$1" ]; then echo "❌ Error: Repository name required" echo "" echo "Usage: $0 " echo "" echo "Examples:" echo " $0 infoscreen_2025" echo " $0 infoscreen-2025" echo " $0 infoscreen_server_2025" echo "" echo "Your GitHub username appears to be: robbstarkaustria" exit 1 fi REPO_NAME="$1" GITHUB_USER="robbstarkaustria" REPO_URL="https://github.com/${GITHUB_USER}/${REPO_NAME}.git" echo "Repository: ${REPO_URL}" echo "" # Add the remote origin echo "🔄 Adding remote origin..." git remote add origin "$REPO_URL" if [ $? -eq 0 ]; then echo "✅ Remote origin added successfully" else echo "⚠️ Remote might already exist, removing and re-adding..." git remote remove origin 2>/dev/null git remote add origin "$REPO_URL" fi # Show current remotes echo "" echo "📋 Current remotes:" git remote -v echo "" echo "🔄 Fetching from remote repository..." git fetch origin echo "" echo "🔄 Setting upstream and pushing..." git branch --set-upstream-to=origin/main main # Try to push (might require authentication) echo "" echo "🚀 Pushing to GitHub..." echo "Note: You may need to authenticate with GitHub" git push -u origin main if [ $? -eq 0 ]; then echo "" echo "🎉 Successfully connected and pushed to GitHub!" echo "Repository URL: https://github.com/${GITHUB_USER}/${REPO_NAME}" else echo "" echo "⚠️ Push failed. This might be because:" echo "1. You need to authenticate with GitHub" echo "2. The repository doesn't exist" echo "3. You don't have push permissions" echo "" echo "Try running: git push -u origin main" echo "Or use GitHub CLI: gh auth login" fi