diff --git a/scm.py b/scm.py index 662ab7e51..c374a66e7 100644 --- a/scm.py +++ b/scm.py @@ -226,7 +226,11 @@ class GIT(object): return remote, upstream_branch # Else, try to guess the origin remote. - if 'origin/master' in GIT.GetRemoteBranches(cwd): + remote_branches = GIT.GetRemoteBranches(cwd) + if 'origin/main' in remote_branches: + # Fall back on origin/main if it exits. + return 'origin', 'refs/heads/main' + elif 'origin/master' in remote_branches: # Fall back on origin/master if it exits. return 'origin', 'refs/heads/master'