Skip to content

Instantly share code, notes, and snippets.

@jorgerance
Created December 18, 2019 14:57
Show Gist options
  • Save jorgerance/45f05b065c53b960627f90332cd7b09e to your computer and use it in GitHub Desktop.
Save jorgerance/45f05b065c53b960627f90332cd7b09e to your computer and use it in GitHub Desktop.
github_delete-list.sh
#!/bin/bash
TOKEN=<YOUR_GITHUB_OAUTH_TOKEN>
# Remember to enable de "delete_repo" OAuth scope on the token you just defined
# Delete a set o repositories defined on a plain text file
# i.e.:
# user@host ~/ $ cat repositories_to_delete.txt
# username/reponame1
# username/reponame2
# username/reponame3
# username/reponame4
# username/reponame5
# username/reponame6
# username/reponame7
# username/reponame8
# user@host ~/ $
cat repositories_to_delete.txt | while read r; do
echo " -> Deleting $r"
curl -X DELETE -H "Authorization: token $TOKEN" https://api.github.com/repos/$r done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment