@Nullable
  private static String createGithubRepository(
      @NotNull Project project,
      @NotNull GithubAuthDataHolder authHolder,
      @NotNull ProgressIndicator indicator,
      @NotNull final String name,
      @NotNull final String description,
      final boolean isPrivate) {

    try {
      return GithubUtil.runTask(
              project,
              authHolder,
              indicator,
              new ThrowableConvertor<GithubAuthData, GithubRepo, IOException>() {
                @NotNull
                @Override
                public GithubRepo convert(@NotNull GithubAuthData auth) throws IOException {
                  return GithubApiUtil.createRepo(auth, name, description, isPrivate);
                }
              })
          .getHtmlUrl();
    } catch (IOException e) {
      GithubNotifications.showError(project, "Failed to create GitHub Repository", e);
      return null;
    }
  }
  private static void rebaseMyGithubFork(
      @NotNull final Project project, @Nullable final VirtualFile file) {
    final GitRepository gitRepository = GithubUtil.getGitRepository(project, file);
    if (gitRepository == null) {
      GithubNotifications.showError(
          project, CANNOT_PERFORM_GITHUB_REBASE, "Can't find git repository");
      return;
    }

    BasicAction.saveAll();

    new Task.Backgroundable(project, "Rebasing GitHub fork...") {
      @Override
      public void run(@NotNull ProgressIndicator indicator) {
        gitRepository.update();
        String upstreamRemoteUrl = GithubUtil.findUpstreamRemote(gitRepository);

        if (upstreamRemoteUrl == null) {
          LOG.info("Configuring upstream remote");
          indicator.setText("Configuring upstream remote...");
          upstreamRemoteUrl = configureUpstreamRemote(project, gitRepository, indicator);
          if (upstreamRemoteUrl == null) {
            return;
          }
        }

        if (!GithubUrlUtil.isGithubUrl(upstreamRemoteUrl)) {
          GithubNotifications.showError(
              project,
              CANNOT_PERFORM_GITHUB_REBASE,
              "Configured upstream is not a GitHub repository: " + upstreamRemoteUrl);
          return;
        } else {
          final GithubFullPath userAndRepo =
              GithubUrlUtil.getUserAndRepositoryFromRemoteUrl(upstreamRemoteUrl);
          final String login = GithubSettings.getInstance().getLogin();
          if (userAndRepo != null) {
            if (userAndRepo.getUser().equals(login)) {
              GithubNotifications.showError(
                  project,
                  CANNOT_PERFORM_GITHUB_REBASE,
                  "Configured upstream seems to be your own repository: " + upstreamRemoteUrl);
              return;
            }
          }
        }

        LOG.info("Fetching upstream");
        indicator.setText("Fetching upstream...");
        if (!fetchParent(project, gitRepository, indicator)) {
          return;
        }

        LOG.info("Rebasing current branch");
        indicator.setText("Rebasing current branch...");
        rebaseCurrentBranch(project, gitRepository, indicator);
      }
    }.queue();
  }
  @Nullable
  private static GithubRepoDetailed loadRepositoryInfo(
      @NotNull Project project,
      @NotNull GitRepository gitRepository,
      @NotNull ProgressIndicator indicator) {
    final String remoteUrl = GithubUtil.findGithubRemoteUrl(gitRepository);
    if (remoteUrl == null) {
      GithubNotifications.showError(
          project, CANNOT_PERFORM_GITHUB_REBASE, "Can't find github remote");
      return null;
    }
    final GithubFullPath userAndRepo = GithubUrlUtil.getUserAndRepositoryFromRemoteUrl(remoteUrl);
    if (userAndRepo == null) {
      GithubNotifications.showError(
          project, CANNOT_PERFORM_GITHUB_REBASE, "Can't process remote: " + remoteUrl);
      return null;
    }

    try {
      return GithubUtil.runWithValidAuth(
          project,
          indicator,
          new ThrowableConvertor<GithubAuthData, GithubRepoDetailed, IOException>() {
            @Override
            @NotNull
            public GithubRepoDetailed convert(GithubAuthData authData) throws IOException {
              return GithubApiUtil.getDetailedRepoInfo(
                  authData, userAndRepo.getUser(), userAndRepo.getRepository());
            }
          });
    } catch (GithubOperationCanceledException e) {
      return null;
    } catch (IOException e) {
      GithubNotifications.showError(project, "Can't load repository info", e);
      return null;
    }
  }