- Automates the deletion of multiple repositories.
- Works with both public and private repositories.
To use the script, you’ll need a GitHub Personal Access Token. Follow these steps:
- Go to your GitHub settings.
- Click Generate new token.
- Select the scopes:
repo(for private repositories).delete_repo(to enable repository deletion).
- Generate and copy the token. Store it securely, as you won’t be able to see it again!
Ensure Python is installed to run the scripts.
Follow these steps to automate the deletion of multiple GitHub repositories:
Install the required Python library using pip:
pip install requestsEdit the bulk_delete.py script to include:
- Your repository names.
- Your personal access token.
For example, update the repos_to_delete.txt file as follows:
repo-name-1
repo-name-2
repo-name-3Run the script in your terminal:
python bulk_delete.pyThe script will loop through the specified repositories and delete them using the GitHub API.
- Double-check the
repos_to_deletelist to avoid accidental deletions. - Deleted repositories cannot be recovered, so ensure you've backed up any important data.
- If you encounter issues, ensure your personal access token has the correct permissions (
delete_repo).