Created
June 19, 2020 09:35
-
-
Save tperalta82/f41bc8811ab505420fb76dfa484bc4e1 to your computer and use it in GitHub Desktop.
Remove Github Repos Batch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!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