diff --git a/src/git/sub-providers/remotes.ts b/src/git/sub-providers/remotes.ts index ed3e9b42c8d99..3a69ce395b9a2 100644 --- a/src/git/sub-providers/remotes.ts +++ b/src/git/sub-providers/remotes.ts @@ -85,7 +85,14 @@ export abstract class RemotesGitProviderBase implements GitRemotesSubProvider { if (cancellation?.isCancellationRequested) throw new CancellationError(); - const defaultRemote = remotes.find(r => r.default)?.name; + let defaultRemote = remotes.find(r => r.default)?.name; + if (defaultRemote == null) { + const upstream = remotes.find(r => r.name === 'upstream'); + if (upstream != null) { + await this.setRemoteAsDefault(repoPath, 'upstream', true); + defaultRemote = 'upstream'; + } + } const currentBranchRemote = (await this.provider.branches.getBranch(remotes[0].repoPath))?.getRemoteName(); const weighted: [number, GitRemote][] = [];