Skip to content

Instantly share code, notes, and snippets.

@kliu
Last active August 13, 2021 04:19
Show Gist options
  • Save kliu/f29a1c0f1832060de052c73e6e900997 to your computer and use it in GitHub Desktop.
Save kliu/f29a1c0f1832060de052c73e6e900997 to your computer and use it in GitHub Desktop.
Batch delete repos
  1. Create token with repo and delete repo scope, https://github.com/settings/tokens
  2. Install github command line tools. https://cli.github.com/manual/
  3. List repos gh repo list --fork --limit 500 > repos.txt
  4. echo "USER=kliu\nTOKEN=123\n" > clean.sh
  5. cat repos.txt| awk '{printf "curl -XDELETE -u ${USER}:${TOKEN} https://api.github.com/repos/"$1"\n"}' >> clean.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment