This script will take every empty repository on a GitHub Enterprise Instance and list them, deleting them if desired. This is no longer actively maintained, and therefore may not function as originally intended. The recommendation is to run this in a sandbox environment first.
For a GitHub Enterprise Instance, lists every empty repository in format : separated by new lines. Deleting them if passed the option --execute=TRUE
- Example Output: List all empty repositories organization:repository1 organization:repository2 organization:repository3
Before running this script, you must create a Personal Access Token (PAT) at https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ with the permissions and admin:org scopes and <delete_repo>. Read more about scopes here: https://developer.github.com/apps/building-oauth-apps/scopes-for-oauth-apps/
Once created, you must export your PAT as an environment variable named <GITHUB_TOKEN>.
- Exporting PAT as GITHUB_TOKEN $ export GITHUB_TOKEN=abcd1234efg567
Additionally you will need to set the $API_ROOT at the top of the script to your instance of GitHub Enterprise.
repo-reaper - For a GitHub Enterprise Instance, lists every empty repository in format : and deletes them if --execute=TRUE
option is passed.
repo-reaper [--org=MyOrganization] [--execute=TRUE]
--org | -o
When running the tool, this flag sets which organization's repositories you want to inspect and delete (if they're empty).
--execute | -e
When running the tool, this flag will delete every repo listed.
- NOTE: You should run the script without this option first, verifying that you want to delete every repository listed.
- Lists all empty repositories for the given org that are empty.
$ bash repo-reaper --org=MyOrganization
- Lists all empty repositories for the given org that are empty and deletes them.
$ bash repo-reaper --org=MyOrganization --execute=TRUE
All documentation can be found at the GitHub Developer Docs page.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- Thomas Hughes - Maintainer / On-Going Support - @IAmHughes
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details.