Files
infoscreen/connect_to_github.sh
RobbStarkAustria 4a97ad4f1d Merge with remote repository and apply database cleanup
- Merged remote history with local workspace changes
- Removed obsolete database initialization scripts (init_database.py, init_db.py, init_mariadb.py, test_sql.py)
- Added new comprehensive database initialization script (initialize_database.py)
- Added documentation (DATABASE_GUIDE.md, CLEANUP_SUMMARY.md)
- Updated init_defaults.py comment
- Added GitHub connection helper script
2025-10-10 15:28:04 +00:00

73 lines
1.9 KiB
Bash
Executable File

#!/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 <repository-name>"
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