#!/bin/bash # Script to fix git issues on aitbc-cascade server and push to gitea echo "=== AITBC Git Fix Script ===" echo "This script will help commit and push changes to gitea.bubuit.net" # Navigate to AITBC directory cd /opt/aitbc echo "Current directory: $(pwd)" echo "Current branch: $(git branch --show-current)" # Show git status echo -e "\n=== Git Status ===" git status # Show uncommitted changes echo -e "\n=== Modified Files ===" git diff --name-only # Show untracked files echo -e "\n=== Untracked Files ===" git ls-files --others --exclude-standard # Add gitea remote if not exists if ! git remote | grep -q "gitea"; then echo -e "\n=== Adding Gitea Remote ===" git remote add gitea https://gitea.bubuit.net/oib/AITBC.git echo "Added gitea remote" else echo -e "\n=== Gitea remote already exists ===" fi # Show remotes echo -e "\n=== Git Remotes ===" git remote -v # Interactive commit prompt echo -e "\n=== Commit Options ===" echo "1. Add and commit all changes" echo "2. Add specific files" echo "3. Show detailed diff first" echo "4. Exit without committing" read -p "Choose option (1-4): " choice case $choice in 1) echo "Adding all changes..." git add . read -p "Enter commit message: " msg git commit -m "$msg" ;; 2) echo "Available files to add:" git status --porcelain read -p "Enter files to add (space separated): " files git add $files read -p "Enter commit message: " msg git commit -m "$msg" ;; 3) echo "Showing detailed diff..." git diff read -p "Press Enter to continue..." ;; 4) echo "Exiting without committing" exit 0 ;; *) echo "Invalid option" exit 1 ;; esac # Push options echo -e "\n=== Push Options ===" echo "1. Push to gitea" echo "2. Push to origin" echo "3. Push to both" echo "4. Skip pushing" read -p "Choose option (1-4): " push_choice case $push_choice in 1) echo "Pushing to gitea..." git push gitea $(git branch --show-current) ;; 2) echo "Pushing to origin..." git push origin $(git branch --show-current) ;; 3) echo "Pushing to both remotes..." git push gitea $(git branch --show-current) git push origin $(git branch --show-current) ;; 4) echo "Skipping push" ;; *) echo "Invalid push option" ;; esac echo -e "\n=== Script Complete ==="