GitRemote (@NotNull ProgressIndicator indicator, @NotNull GHRepositoryPath parentRepoPath) { LOG.info("Configuring upstream remote"); indicator.setText(GithubBundle.message("rebase.process.configuring.upstream.remote")); GitRemote upstreamRemote = findRemote(parentRepoPath); if (upstreamRemote != null) { LOG.info("Correct upstream remote already exists"); return upstreamRemote; } LOG.info("Adding GitHub parent as a remote host"); indicator.setText(GithubBundle.message("rebase.process.adding.github.parent.as.remote.host")); String parentRepoUrl = GithubGitHelper.getInstance().getRemoteUrl(myAccount.getServer(), parentRepoPath); try { myGit.addRemote(myRepository, UPSTREAM_REMOTE_NAME, parentRepoUrl).throwOnError(); } catch (VcsException e) { GithubNotifications.showError(myProject, GithubNotificationIdsHolder.REBASE_CANNOT_CONFIGURE_UPSTREAM_REMOTE, GithubBundle.message("rebase.error"), GithubBundle.message("cannot.configure.remote", UPSTREAM_REMOTE_NAME, e.getMessage())); return null; } myRepository.update(); upstreamRemote = findRemote(parentRepoPath); if (upstreamRemote == null) { GithubNotifications.showError(myProject, GithubNotificationIdsHolder.REBASE_CANNOT_CONFIGURE_UPSTREAM_REMOTE, GithubBundle.message("rebase.error"), GithubBundle.message("rebase.error.upstream.not.found", UPSTREAM_REMOTE_NAME)); } return upstreamRemote; }