Delete Push to Gitea for Memories.sh

This commit is contained in:
maq
2025-11-09 11:30:04 -08:00
parent fc68d4dd56
commit f4278676e4

View File

@@ -1,77 +0,0 @@
#!/bin/bash
# Universal Git Automation: Init, Commit, and Push to Gitea
# Works for ANY project! Run from your project directory.
# Usage: bash setup-git-gitea.sh
# Author: ProjectForge (generalized from Memories project)
set -e # Exit on any error
# Detect project name from current directory
PROJECT_DIR="$(basename $(pwd))"
echo "=== Universal Git to Gitea Automation ==="
echo "Project: $PROJECT_DIR"
echo "Current directory: $(pwd)"
# Check if Git is installed
if ! command -v git &> /dev/null; then
echo "Error: Git is not installed. Install it from https://git-scm.com/"
exit 1
fi
# Step 1: Initialize Git if needed
if [ ! -d ".git" ]; then
echo "Initializing Git repository..."
git init
else
echo "Git repository already exists."
fi
# Step 2: Add all project files (customize this line if you want specific files)
echo "Adding all project files..."
git add .
# Step 3: Commit (prompt for message)
DEFAULT_COMMIT_MSG="Initial commit: $PROJECT_DIR project setup with docs and code"
echo ""
echo "Enter commit message (or press Enter for default: $DEFAULT_COMMIT_MSG):"
read -r COMMIT_MSG
if [ -z "$COMMIT_MSG" ]; then
COMMIT_MSG="$DEFAULT_COMMIT_MSG"
fi
git commit -m "$COMMIT_MSG" || echo "No changes to commit (repo may already have initial commit)"
# Step 4: Prompt for Gitea repo URL
echo ""
echo "Enter your Gitea repository URL for this project."
echo "Examples:"
echo " - HTTPS: http://localhost:3000/username/$PROJECT_DIR.git"
echo " - SSH: git@your-server:username/$PROJECT_DIR.git"
echo " (Create the empty repo in Gitea first if needed)"
read -r GITEA_URL
if [ -z "$GITEA_URL" ]; then
echo "Error: URL is required."
exit 1
fi
# Step 5: Set up remote and push
echo "Setting up remote: $GITEA_URL"
if git remote | grep -q origin; then
echo "Updating existing remote URL..."
git remote set-url origin "$GITEA_URL"
else
git remote add origin "$GITEA_URL"
fi
echo "Setting branch to main..."
git branch -M main
echo "Pushing to Gitea (may prompt for credentials)..."
git push -u origin main
echo ""
echo "=== Success! ==="
echo "Your $PROJECT_DIR project is now in Gitea at: $GITEA_URL"
echo "Check the repo in your browser for files and commits."
echo "If you have a CI/CD workflow (.gitea/workflows/), check the 'Actions' tab."
echo "Future updates: git add . && git commit -m 'Update' && git push"