fix: Always clone with OAuth token when provided

Github Enterprise servers with 'Anonymous Git read access' disabled
cause `git ls-remote` to fail (128) for a repo's `clone_url`. Using the
OAuth token when provided allows cloning private AND public repos when
Anonymous Git read access is disabled.
This commit is contained in:
Samantha Baldwin
2021-02-12 00:46:06 -05:00
parent a53d7f6849
commit f62c4eaf8b

View File

@@ -420,7 +420,7 @@ def get_github_repo_url(args, repository):
return repository['ssh_url'] return repository['ssh_url']
auth = get_auth(args, encode=False, for_git_cli=True) auth = get_auth(args, encode=False, for_git_cli=True)
if auth and repository['private'] is True: if auth:
repo_url = 'https://{0}@{1}/{2}/{3}.git'.format( repo_url = 'https://{0}@{1}/{2}/{3}.git'.format(
auth, auth,
get_github_host(args), get_github_host(args),