Skip to content

Instantly share code, notes, and snippets.

@tomasgeci
Last active October 19, 2022 10:52
Show Gist options
  • Select an option

  • Save tomasgeci/7cb0695e9ab1570d175e946c79edf4d0 to your computer and use it in GitHub Desktop.

Select an option

Save tomasgeci/7cb0695e9ab1570d175e946c79edf4d0 to your computer and use it in GitHub Desktop.
Github CLI batch delete repos

Github CLI cheatsheet

List examples

  • gh repo list --limit 100 --visibility private
  • gh repo list --limit 100 --visibility public
  • gh repo list --limit 100 --visibility public --fork
  • gh repo list --limit 100 --visibility public --source
  • gh repo list --limit 100 --visibility public --json nameWithOwner
  • gh repo list --limit 100 --visibility public --json nameWithOwner | jq '.[] | .nameWithOwner'

Batch delete example

  • gh repo list --limit 100 --visibility public --json nameWithOwner | jq '.[] | .nameWithOwner' > repo.txt
  • open and save repo.txt with LF - this is important !!!
  • while read r;do gh repo delete $r --confirm;done < repo1.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment