GHRepositoryPath (@NotNull String remoteUrl) { remoteUrl = removeProtocolPrefix(removeEndingDotGit(remoteUrl)); int index1 = remoteUrl.lastIndexOf('/'); if (index1 == -1) { return null; } String url = remoteUrl.substring(0, index1); int index2 = Math.max(url.lastIndexOf('/'), url.lastIndexOf(':')); if (index2 == -1) { return null; } final String username = remoteUrl.substring(index2 + 1, index1); final String reponame = remoteUrl.substring(index1 + 1); if (username.isEmpty() || reponame.isEmpty()) { return null; } return new GHRepositoryPath(username, reponame); }