Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Delete all your github repositories
token="Get from Github"
# Gets a list of the repositories you own (not ones granted through organisation)
curl -H "Authorization: token ${token}" | grep git_url | sed -r 's/( "git_url": "git:\/\/\/)//' | sed -r 's/.git",//' > url_list.txt
# Deletes all the repositories it found on the line before
while read r;do curl -XDELETE -H 'Authorization: token ${token}' "$r ";done < url_list.txt
rm url_list.txt

This comment has been minimized.

Copy link

febs commented Jan 1, 2019

Line 6 should have double quotes for the -H parameter for the ${token} variable to be substituted. :-) Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.