Skip to content

Commit 999e710

Browse files
authored
Merge pull request #109 from alneberg/github_backup_fix
Access token is needed for private repos
2 parents d519ba8 + 918c7c5 commit 999e710

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

backup_github.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,10 @@ def backup(user, password, access_token, organizations, dest):
7474

7575
for repository in chain(*repositories):
7676
logger.info("Github API rate limit: {}".format(github_instance.get_rate_limit()))
77-
if password is not None and repository.private is True:
77+
if access_token is not None and repository.private is True:
7878
source = repository.clone_url.replace(
79-
"https://",
80-
"https://{}:{}@".format(user, password)
81-
)
79+
"https://", "https://{}:{}@".format(user, access_token)
80+
)
8281
else:
8382
source = repository.clone_url
8483

@@ -100,7 +99,7 @@ def backup(user, password, access_token, organizations, dest):
10099
logger.error("There was an error fetching the branches "
101100
"from the repository {}, "
102101
"skipping it".format(repository.name))
103-
pass
102+
continue
104103
logger.info("Finished copying repo {}".format(repository.name))
105104
# Otherwise clone the repository and fetch all branches
106105
else:
@@ -115,7 +114,7 @@ def backup(user, password, access_token, organizations, dest):
115114
logger.error("ERROR: Error cloning repository {}, "
116115
"skipping it".format(repository.name))
117116
logger.error(str(e))
118-
pass
117+
continue
119118
try:
120119
with cd(repository_path):
121120
check_call(track_all_branches, shell=True,
@@ -129,7 +128,6 @@ def backup(user, password, access_token, organizations, dest):
129128
repository.name
130129
))
131130
logger.error(str(e))
132-
pass
133131

134132

135133
def compress_and_move(source, final_dest):

0 commit comments

Comments
 (0)