Last active
June 4, 2018 22:42
-
-
Save brianherman/11036e2466d4c5843b87acdbcc1ca735 to your computer and use it in GitHub Desktop.
delete github
This file contains hidden or 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
#pip install pygithub | |
#python delete.py <username> <token> | |
#https://github.com/settings/tokens | |
#Create a token with delete permission and all other repo permission | |
#https://i.imgur.com/1mrTjTJ.png | |
import sys | |
from github import Github | |
username = sys.argv[1] | |
token = sys.argv[2] | |
g = Github(username, token) | |
for repo in g.get_user().get_repos(): | |
if repo.private: | |
yorn = input("Are you sure you want to delete {} (Y/N)? ".format(repo.name)) | |
if yorn.upper() == 'Y': | |
try: | |
repo.delete() | |
print('deleted {}'.format(repo.name)) | |
except: | |
print('error with delete'.format(repo.name)) | |
import traceback | |
traceback.print_exc() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if repo.private == True:
=>if repo.private: