(Inspired by the resources listed at the bottom of this Gist)
Deleting old repos in bulk is quite easy if you've got a WSL instance at hand.
Open a text editor, and list each repository you want to delete in the form of userName\repoName
with one per line.
Because this is a regex search, you'll want to replace any spaces with wildcards (.*):
ragdata\old-repo-one
ragdata\old.*repo-two
Save that file somewhere you won't lose it.
Open a browser to Github and create a new personal access token for yourself. You'll need the delete_repo
permission (see https://github.com/settings/tokens/new)
Once you've got your access token, copy it to your clipboard and execute the following command under a WSL terminal:
export TOKEN="<paste your token here>"
export HITLIST_PATH="<path to the file you saved above>"
So that you don't forget this snippet too quickly, stick it in your .bash_functions file so that you can use it anytime:
gitBulkDelete() {
while read r;
do
curl -XDELETE -H 'Authorization: token "$TOKEN"' "https://api.github.com/repos/$r "
done < "$HITLIST_PATH"
}
Now all you need to do is execute your function. Don't forget to source
your .bash_functions file if you haven't before now:
gitBulkDelete