Add GiteaMigrate.sh

This commit is contained in:
ton
2025-09-26 08:43:02 +00:00
commit 08a8d559f9

27
GiteaMigrate.sh Normal file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
# *** manually CREATE EVERY empty repos in a new Git server before using this script to migrate
# Old and new Gitea URLs
OLD_GITEA_URL="http://192.168.1.100:3000"
NEW_GITEA_URL="https://git.yiem.cc"
USERNAME="ton"
# Manually list the repo names (no token, so we can't fetch them via API)
REPOS=("GeneralUtils" "YiemAgent" "SQLLLM" "tonBookmarks" "LLMMCTS" "ImageUtils" "FormatCorrector" "ChatAgent_v2" "ChatAgent" "GeneralUtilsGPU" "Mosquitto" "CommUtils" "IronpenGPU" "Ironpen" "SNNUtils" "ANNUtils") # Add your repo names here
mkdir -p gitea-migration && cd gitea-migration
for REPO in "${REPOS[@]}"; do
echo "🔗 Cloning $REPO from old Gitea..."
git clone --mirror "$OLD_GITEA_URL/$USERNAME/$REPO.git"
cd "$REPO.git" || { echo "❌ Failed to enter $REPO.git"; exit 1; }
echo "📦 Pushing $REPO to new Gitea (will prompt for password)..."
git remote set-url origin "$NEW_GITEA_URL/$USERNAME/$REPO.git"
git push --mirror
cd ..
echo "$REPO migrated!"
done