Files
myprojplanet_vite/migrate-repos.sh
Surya Paolo 6d78f82099 - aggiornamento di tante cose...
- generazione Volantini
- pagina RIS
2025-12-17 10:07:42 +01:00

29 lines
903 B
Bash
Executable File

#!/bin/bash
# Salva come migrate-repos.sh
GITEA_URL="http://95.216.147.38:3000"
USERNAME="surya"
TOKEN="8ed0622aac269414f4d333d0c89e22b1c42dd4d1" # Crea su Gitea: Settings → Applications → Generate Token
SEARCH_PATH="$HOME/myproject"
# Trova tutti i repository
find "$SEARCH_PATH" -name ".git" -type d 2>/dev/null | while read gitdir; do
REPO_PATH=$(dirname "$gitdir")
REPO_NAME=$(basename "$REPO_PATH")
echo "Processing: $REPO_NAME"
# Crea repository su Gitea via API
curl -X POST "$GITEA_URL/api/v1/user/repos" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"name\":\"$REPO_NAME\",\"private\":false}"
# Push
cd "$REPO_PATH"
git remote remove origin 2>/dev/null
git remote add origin "$GITEA_URL/$USERNAME/$REPO_NAME.git"
git push -u origin --all
git push -u origin --tags
done