Skip to content

Instantly share code, notes, and snippets.

@tperalta82
Created June 19, 2020 09:35
Show Gist options
  • Save tperalta82/f41bc8811ab505420fb76dfa484bc4e1 to your computer and use it in GitHub Desktop.
Save tperalta82/f41bc8811ab505420fb76dfa484bc4e1 to your computer and use it in GitHub Desktop.
Remove Github Repos Batch
#!bin/bash
sudo apt update
sudo apt full-upgrade
sudo apt install curl jq
curl "https://api.github.com/users/YOURUSERNAME/repos?per_page=100&page=1" | jq -r '.[] | .name' | sed 's\^\YOURUSERNAME/\g' > delete_repos.txt
##code delete_repos.txt
read -p "Edit delete_repos.txt and delete the repos you want to keep from the list, then create a github token with delete_repos permissions"
while read repo; do curl -X DELETE -H "Authorization: token YOUR_TOKEN" "https://api.github.com/repos/$repo"; done < delete_repos.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment