Deleting and archiving repos via command line interface in the terminal using a script (for organizations); accelerating the time spent on the task if you have a large supply of repos to manage. Note if you are doing this for an individual user profile, you will need to adjust the script slightly.
- Generate a fine-grained Personal Access Token ID ($PAT_ID)
- Request that the organization accept the token, review permissions
- Test for org-repo permissions, run in the terminal:
curl -H "Authorization: Bearer $PAT_ID" https://api.github.com/repos/<Organization-Name>/<repo-name>
- Download the
manage_repos.sh
file - Replace $PAT_ID with personal access token; or create a separate environment variable file
- Enable file by running
chmod +x manage_repos.sh
in the terminal - Run the file by running
./manage_repos.sh
in the terminal