Skip to content

Instantly share code, notes, and snippets.

@gormih
Last active September 2, 2020 14:16
Show Gist options
  • Save gormih/49c66391537521c8c302ce947cd7056b to your computer and use it in GitHub Desktop.
Save gormih/49c66391537521c8c302ce947cd7056b to your computer and use it in GitHub Desktop.
Remove user from all repositories, exclude allowed owners.
from github import Github
def go_github():
allowed_acc = ['allowed_friend1', 'allowed_friend2', 'username']
account = Github("username", "password")
for repo in account.get_user().get_repos():
owner = repo.owner.login
if owner not in allowed_acc:
print(owner)
repo.remove_from_collaborators('username')
if __name__ == '__main__':
go_github()
@gormih
Copy link
Author

gormih commented Sep 2, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment