Skip to content

Instantly share code, notes, and snippets.

@gastaldi
Last active May 24, 2018 14:35
Show Gist options
  • Save gastaldi/2d47ca122ad4a18c4b2deaf262f8feba to your computer and use it in GitHub Desktop.
Save gastaldi/2d47ca122ad4a18c4b2deaf262f8feba to your computer and use it in GitHub Desktop.
Delete all github repositories
#!/usr/bin/env bash
#your github token
TOKEN=xxxx
echo The following repositories will be deleted:
http https://api.github.com/user/repos "Authorization:token $TOKEN" per_page==100 type==owner | jq '.[].full_name'
read -p "Continue (y/n)?" CONT
if [ "$CONT" = "y" ]; then
echo Deleting repositories
http https://api.github.com/user/repos "Authorization:token $TOKEN" per_page==100 type==owner | jq '.[].full_name' | xargs -I '{}' http DELETE https://api.github.com/repos/'{}' "Authorization:token $TOKEN"
else
echo Nothing was done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment