clockfort / GitHub-Backup

Backup all the repositories of a github user or organization automatically.
Creative Commons Zero v1.0 Universal
359 stars 103 forks source link

Organization backup doesn't work #43

Closed enricodias closed 3 years ago

enricodias commented 3 years ago

I followed the instructions in the README but I couldn't make the script work for organizations. There is no logs of the token being used on my Github account.

github-backup TOKEN github_backup -o ORGANIZATION --all

Traceback (most recent call last):
  File "/home/***/.local/bin/github-backup", line 11, in <module>
    load_entry_point('GitHub-Backup==0.1', 'console_scripts', 'github-backup')()
  File "/home/***/.local/lib/python2.7/site-packages/github_backup/github_backup.py", line 108, in main
    account = gh.get_organization(args.login_or_token)
  File "/home/***/.local/lib/python2.7/site-packages/github/MainClass.py", line 293, in get_organization
    headers, data = self.__requester.requestJsonAndCheck("GET", "/orgs/" + login)
  File "/home/***/.local/lib/python2.7/site-packages/github/Requester.py", line 322, in requestJsonAndCheck
    verb, url, parameters, headers, input, self.__customConnection(url)
  File "/home/***/.local/lib/python2.7/site-packages/github/Requester.py", line 345, in __check
    raise self.__createException(status, responseHeaders, output)
github.GithubException.UnknownObjectException: 404 {"documentation_url": "https://docs.github.com/rest/reference/orgs#get-an-organization", "message": "Not Found"}
github-backup -o ORGANIZATION -v all -a owner --all -p TOKEN USERNAME github_backup
Traceback (most recent call last):
  File "/home/***/.local/bin/github-backup", line 11, in <module>
    load_entry_point('GitHub-Backup==0.1', 'console_scripts', 'github-backup')()
  File "/home/***/.local/lib/python2.7/site-packages/github_backup/github_backup.py", line 106, in main
    account = gh.get_organization(args.org)
AttributeError: 'Namespace' object has no attribute 'org'
stv0g commented 3 years ago

Seems like this is an easy fix. Just one variable was wrongly named.

stv0g commented 3 years ago

@enricodias can you please try again?

enricodias commented 3 years ago

Seems to work now. Thanks.