Files
dev-notes/assets/files/gitea/git-flip
2025-11-30 21:24:04 -06:00

27 lines
673 B
Bash

#!/usr/bin/env bash
set -euo pipefail
GITEA_BASE="https://git.keithsolomon.net"
GITEA_USER="keith" # your username
GITEA_TOKEN="f4b01fa50f56271f8ba002221fb68404de955077"
echo "Fetching repos for user: $GITEA_USER"
repos=$(curl -sS \
-H "Authorization: token $GITEA_TOKEN" \
"$GITEA_BASE/api/v1/users/$GITEA_USER/repos" | jq -r '.[].name')
for repo in $repos; do
echo "Setting $repo → public..."
curl -sS -X PATCH \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"private":false}' \
"$GITEA_BASE/api/v1/repos/$GITEA_USER/$repo" \
>/dev/null
echo "$repo is now public"
done
echo "Done."